Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/27/09 15:42:04 (15 years ago)
Author:
epitzer
Message:

Migration of DataAnalysis, GP, GP.StructureIdentification and Modeling to new Persistence-3.3 (#603)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.4/TreeEvaluatorBase.cs

    r1891 r1914  
    2828using System.Diagnostics;
    2929using HeuristicLab.DataAnalysis;
     30using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3031
    3132namespace HeuristicLab.GP.StructureIdentification {
     
    3435  /// </summary>
    3536  public abstract class TreeEvaluatorBase : ItemBase, ITreeEvaluator {
     37
    3638    protected const double EPSILON = 1.0e-7;
     39
     40    [Storable]
    3741    protected double estimatedValueMax;
     42
     43    [Storable]
    3844    protected double estimatedValueMin;
     45
     46    [Storable]
     47    protected Dataset dataset;
    3948
    4049    protected class Instr {
     
    4958    protected Instr[] codeArr;
    5059    protected int PC;
    51     protected Dataset dataset;
    5260    protected int sampleIndex;
    5361
     
    135143      return clone;
    136144    }
    137 
    138     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    139       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    140       XmlAttribute minEstimatedValueAttr = document.CreateAttribute("MinEstimatedValue");
    141       minEstimatedValueAttr.Value = XmlConvert.ToString(estimatedValueMin);
    142       node.Attributes.Append(minEstimatedValueAttr);
    143 
    144       XmlAttribute maxEstimatedValueAttr = document.CreateAttribute("MaxEstimatedValue");
    145       maxEstimatedValueAttr.Value = XmlConvert.ToString(estimatedValueMax);
    146       node.Attributes.Append(maxEstimatedValueAttr);
    147 
    148       node.AppendChild(PersistenceManager.Persist("Dataset", dataset, document, persistedObjects));
    149       return node;
    150     }
    151 
    152     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    153       base.Populate(node, restoredObjects);
    154       estimatedValueMax = XmlConvert.ToDouble(node.Attributes["MaxEstimatedValue"].Value);
    155       estimatedValueMin = XmlConvert.ToDouble(node.Attributes["MinEstimatedValue"].Value);
    156 
    157       dataset = (Dataset)PersistenceManager.Restore(node.SelectSingleNode("Dataset"), restoredObjects);
    158     }
    159145  }
    160146}
Note: See TracChangeset for help on using the changeset viewer.