Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/05/10 05:23:56 (14 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on parameters and operators
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators/3.3/Counter.cs

    r2740 r2756  
    3636  [Creatable("Test")]
    3737  public sealed class Counter : SingleSuccessorOperator {
    38     public ItemParameter<IntData> Value {
    39       get { return (ItemParameter<IntData>)Parameters["Value"]; }
     38    public LookupParameter<IntData> ValueParameter {
     39      get { return (LookupParameter<IntData>)Parameters["Value"]; }
    4040    }
    41     public ItemParameter<IntData> Increment {
    42       get { return (ItemParameter<IntData>)Parameters["Increment"]; }
     41    public ValueLookupParameter<IntData> IncrementParaneter {
     42      get { return (ValueLookupParameter<IntData>)Parameters["Increment"]; }
     43    }
     44    public IntData Increment {
     45      get { return IncrementParaneter.Value; }
     46      set { IncrementParaneter.Value = value; }
    4347    }
    4448
    4549    public Counter()
    4650      : base() {
    47       Parameters.Add(new ItemParameter<IntData>("Value", "The value which should be incremented."));
    48       Parameters.Add(new ItemParameter<IntData>("Increment", "The increment which is added to the value.", new IntData(1)));
     51      Parameters.Add(new LookupParameter<IntData>("Value", "The value which should be incremented."));
     52      Parameters.Add(new ValueLookupParameter<IntData>("Increment", "The increment which is added to the value.", new IntData(1)));
    4953    }
    5054
    5155    public override ExecutionContextCollection Apply() {
    52       IntData value = (IntData)Value.Value;
    53       IntData increment = (IntData)Increment.Value;
    54       value.Value += increment.Value;
     56      if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new IntData();
     57      ValueParameter.ActualValue.Value += IncrementParaneter.ActualValue.Value;
    5558      return base.Apply();
    5659    }
Note: See TracChangeset for help on using the changeset viewer.