Free cookie consent management tool by TermsFeed Policy Generator

Changeset 309


Ignore:
Timestamp:
06/09/08 19:05:43 (16 years ago)
Author:
gkronber
Message:

fixed a bug that threw Exceptions when loading a GP engine with results (trees)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Functions/SymbolTable.cs

    r308 r309  
    129129
    130130    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    131       base.Populate(node, restoredObjects);
    132       table.Clear();
    133       reverseTable.Clear();
    134       nextFunctionSymbol = int.Parse(node.Attributes["NextFunctionSymbol"].Value);
    135       XmlNode symbolTableNode = node.SelectSingleNode("Table");
    136       foreach(XmlNode entry in symbolTableNode.ChildNodes) {
    137         IFunction function = (IFunction)PersistenceManager.Restore(entry, restoredObjects);
    138         int symbol = int.Parse(entry.Attributes["Symbol"].Value);
    139         table[symbol] = function;
    140         reverseTable[function] = symbol;
     131      if(this == symbolTable) {
     132        base.Populate(node, restoredObjects);
     133        table.Clear();
     134        reverseTable.Clear();
     135        nextFunctionSymbol = int.Parse(node.Attributes["NextFunctionSymbol"].Value);
     136        XmlNode symbolTableNode = node.SelectSingleNode("Table");
     137        foreach(XmlNode entry in symbolTableNode.ChildNodes) {
     138          IFunction function = (IFunction)PersistenceManager.Restore(entry, restoredObjects);
     139          int symbol = int.Parse(entry.Attributes["Symbol"].Value);
     140          table[symbol] = function;
     141          reverseTable[function] = symbol;
     142        }
     143      } else {
     144        symbolTable.Populate(node, restoredObjects);
    141145      }
    142146    }
Note: See TracChangeset for help on using the changeset viewer.