Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/20/08 10:56:51 (17 years ago)
Author:
gkronber
Message:

fixed serialization number-format of double values in DoubleBoundedConstraint and NormalDistributedRandom (ticket #102)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Constraints/DoubleBoundedConstraint.cs

    r2 r138  
    2626using HeuristicLab.Core;
    2727using HeuristicLab.Data;
     28using System.Globalization;
    2829
    2930namespace HeuristicLab.Constraints {
     
    135136      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    136137      XmlAttribute lb = document.CreateAttribute("LowerBound");
    137       lb.Value = LowerBound+"";
     138      lb.Value = LowerBound.ToString(CultureInfo.InvariantCulture);
    138139      XmlAttribute lbi = document.CreateAttribute("LowerBoundIncluded");
    139       lbi.Value = lowerBoundIncluded+"";
     140      lbi.Value = lowerBoundIncluded.ToString();
    140141      XmlAttribute lbe = document.CreateAttribute("LowerBoundEnabled");
    141       lbe.Value = lowerBoundEnabled + "";
     142      lbe.Value = lowerBoundEnabled.ToString();
    142143      XmlAttribute ub = document.CreateAttribute("UpperBound");
    143       ub.Value = upperBound + "";
     144      ub.Value = upperBound.ToString(CultureInfo.InvariantCulture);
    144145      XmlAttribute ubi = document.CreateAttribute("UpperBoundIncluded");
    145       ubi.Value = upperBoundIncluded + "";
     146      ubi.Value = upperBoundIncluded.ToString();
    146147      XmlAttribute ube = document.CreateAttribute("UpperBoundEnabled");
    147       ube.Value = upperBoundEnabled + "";
     148      ube.Value = upperBoundEnabled.ToString();
    148149      node.Attributes.Append(lb);
    149150      if (!lowerBoundIncluded) node.Attributes.Append(lbi);
     
    157158    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    158159      base.Populate(node, restoredObjects);
    159       lowerBound = double.Parse(node.Attributes["LowerBound"].Value);
     160      lowerBound = double.Parse(node.Attributes["LowerBound"].Value, CultureInfo.InvariantCulture);
    160161      if (node.Attributes["LowerBoundIncluded"] != null) {
    161162        lowerBoundIncluded = bool.Parse(node.Attributes["LowerBoundIncluded"].Value);
     
    169170      }
    170171
    171       upperBound = double.Parse(node.Attributes["UpperBound"].Value);
     172      upperBound = double.Parse(node.Attributes["UpperBound"].Value, CultureInfo.InvariantCulture);
    172173      if (node.Attributes["UpperBoundIncluded"] != null) {
    173174        upperBoundIncluded = bool.Parse(node.Attributes["UpperBoundIncluded"].Value);
Note: See TracChangeset for help on using the changeset viewer.