Changeset 2756 for trunk/sources/HeuristicLab.Operators/3.3/Counter.cs
- Timestamp:
- 02/05/10 05:23:56 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Operators/3.3/Counter.cs
r2740 r2756 36 36 [Creatable("Test")] 37 37 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"]; } 40 40 } 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; } 43 47 } 44 48 45 49 public Counter() 46 50 : 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))); 49 53 } 50 54 51 55 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; 55 58 return base.Apply(); 56 59 }
Note: See TracChangeset
for help on using the changeset viewer.