 Timestamp:
 09/13/12 13:13:00 (10 years ago)
 File:

 1 copied
Legend:
 Unmodified
 Added
 Removed

trunk/sources/HeuristicLab.Optimization.Operators/3.3/ExpressionCalculator.cs
r8640 r8642 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 29 30 namespace HeuristicLab. Algorithms.RAPGA{30 namespace HeuristicLab.Optimization.Operators { 31 31 /// <summary> 32 32 /// An operator that evaluates an expression. 33 33 /// </summary> 34 [Item(" Calculator", "An operator that evaluates an expression.")]34 [Item("ExpressionCalculator", "An operator that evaluates an expression.")] 35 35 [StorableClass] 36 public class Calculator : ValuesCollector {36 public class ExpressionCalculator : ValuesCollector { 37 37 [Storable] 38 public Optimization.Calculator Calc{ get; set; }38 public Calculator Calculator { get; set; } 39 39 40 40 #region Parameter Properties … … 57 57 58 58 [StorableConstructor] 59 protected Calculator(bool deserializing) : base(deserializing) { }60 protected Calculator(Calculator original, Cloner cloner)59 protected ExpressionCalculator(bool deserializing) : base(deserializing) { } 60 protected ExpressionCalculator(ExpressionCalculator original, Cloner cloner) 61 61 : base(original, cloner) { 62 this.Calc = cloner.Clone(original.Calc);62 this.Calculator = cloner.Clone(original.Calculator); 63 63 } 64 public Calculator()64 public ExpressionCalculator() 65 65 : base() { 66 66 Parameters.Add(new ValueLookupParameter<IItem>("ExpressionResult", "The result of the evaluated expression.")); … … 75 75 unquoted or in double quotes if they contain special characters or whitespace 76 76 mathematical functions: 77 +, , /, ^ (power), log77 +, , *, /, ^ (power), log 78 78 predicates: 79 79 ==, <, >, isnull, not … … 89 89 If the final value is null, the result variable is removed if it exists.")); 90 90 91 Calc = new Optimization.Calculator();91 Calculator = new Calculator(); 92 92 } 93 93 94 94 public override IDeepCloneable Clone(Cloner cloner) { 95 return new Calculator(this, cloner);95 return new ExpressionCalculator(this, cloner); 96 96 } 97 97 98 98 public override IOperation Apply() { 99 Calc .Formula = Formula;99 Calculator.Formula = Formula; 100 100 var variables = new Dictionary<string, IItem>(); 101 101 foreach (var collectedValue in CollectedValues) 102 102 variables[collectedValue.Name] = collectedValue.ActualValue; 103 ExpressionResult = Calc .GetValue(variables);103 ExpressionResult = Calculator.GetValue(variables); 104 104 return base.Apply(); 105 105 }
Note: See TracChangeset
for help on using the changeset viewer.