Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/27/12 13:46:35 (12 years ago)
Author:
mkommend
Message:

#1890: Improved symbol to opCode lookup in the GP interpreters.

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs

    r8123 r8343  
    806806
    807807    private byte MapSymbolToOpCode(ISymbolicExpressionTreeNode treeNode) {
    808       if (symbolToOpcode.ContainsKey(treeNode.Symbol.GetType()))
    809         return symbolToOpcode[treeNode.Symbol.GetType()];
    810       else
     808      byte opCode;
     809      if (!symbolToOpcode.TryGetValue(treeNode.Symbol.GetType(), out opCode))
    811810        throw new NotSupportedException("Symbol: " + treeNode.Symbol);
    812     }
     811      return opCode;
     812    }
     813
    813814
    814815    public static double AiryA(double x) {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeInterpreter.cs

    r8123 r8343  
    617617
    618618    private byte MapSymbolToOpCode(ISymbolicExpressionTreeNode treeNode) {
    619       if (symbolToOpcode.ContainsKey(treeNode.Symbol.GetType()))
    620         return symbolToOpcode[treeNode.Symbol.GetType()];
    621       else
     619      byte opCode;
     620      if (!symbolToOpcode.TryGetValue(treeNode.Symbol.GetType(), out opCode))
    622621        throw new NotSupportedException("Symbol: " + treeNode.Symbol);
     622      return opCode;
    623623    }
    624624
Note: See TracChangeset for help on using the changeset viewer.