Changeset 3048 for trunk/sources/HeuristicLab.Operators
- Timestamp:
- 03/15/10 23:49:54 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Operators/3.3
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Operators/3.3/Comparator.cs
r3017 r3048 40 40 get { return (ValueLookupParameter<IItem>)Parameters["RightSide"]; } 41 41 } 42 private ValueParameter<Comparison Data> ComparisonParameter {43 get { return (ValueParameter<Comparison Data>)Parameters["Comparison"]; }42 private ValueParameter<Comparison> ComparisonParameter { 43 get { return (ValueParameter<Comparison>)Parameters["Comparison"]; } 44 44 } 45 public LookupParameter<Bool Data> ResultParameter {46 get { return (LookupParameter<Bool Data>)Parameters["Result"]; }45 public LookupParameter<BoolValue> ResultParameter { 46 get { return (LookupParameter<BoolValue>)Parameters["Result"]; } 47 47 } 48 public Comparison DataComparison {48 public Comparison Comparison { 49 49 get { return ComparisonParameter.Value; } 50 50 set { ComparisonParameter.Value = value; } … … 55 55 Parameters.Add(new LookupParameter<IItem>("LeftSide", "The left side of the comparison.")); 56 56 Parameters.Add(new ValueLookupParameter<IItem>("RightSide", "The right side of the comparison.")); 57 Parameters.Add(new ValueParameter<Comparison Data>("Comparison", "The type of comparison.", new ComparisonData(Data.Comparison.Equal)));58 Parameters.Add(new LookupParameter<Bool Data>("Result", "The result of the comparison."));57 Parameters.Add(new ValueParameter<Comparison>("Comparison", "The type of comparison.", new Comparison(Data.ComparisonType.Equal))); 58 Parameters.Add(new LookupParameter<BoolValue>("Result", "The result of the comparison.")); 59 59 } 60 60 … … 68 68 bool b = false; 69 69 switch (Comparison.Value) { 70 case HeuristicLab.Data.Comparison .Less:70 case HeuristicLab.Data.ComparisonType.Less: 71 71 b = i < 0; break; 72 case HeuristicLab.Data.Comparison .LessOrEqual:72 case HeuristicLab.Data.ComparisonType.LessOrEqual: 73 73 b = i <= 0; break; 74 case HeuristicLab.Data.Comparison .Equal:74 case HeuristicLab.Data.ComparisonType.Equal: 75 75 b = i == 0; break; 76 case HeuristicLab.Data.Comparison .GreaterOrEqual:76 case HeuristicLab.Data.ComparisonType.GreaterOrEqual: 77 77 b = i >= 0; break; 78 case HeuristicLab.Data.Comparison .Greater:78 case HeuristicLab.Data.ComparisonType.Greater: 79 79 b = i > 0; break; 80 case HeuristicLab.Data.Comparison .NotEqual:80 case HeuristicLab.Data.ComparisonType.NotEqual: 81 81 b = i != 0; break; 82 82 } 83 ResultParameter.ActualValue = new Bool Data(b);83 ResultParameter.ActualValue = new BoolValue(b); 84 84 return base.Apply(); 85 85 } -
trunk/sources/HeuristicLab.Operators/3.3/ConditionalBranch.cs
r3017 r3048 33 33 [StorableClass] 34 34 public class ConditionalBranch : SingleSuccessorOperator { 35 public LookupParameter<Bool Data> ConditionParameter {36 get { return (LookupParameter<Bool Data>)Parameters["Condition"]; }35 public LookupParameter<BoolValue> ConditionParameter { 36 get { return (LookupParameter<BoolValue>)Parameters["Condition"]; } 37 37 } 38 38 protected OperatorParameter TrueBranchParameter { … … 53 53 public ConditionalBranch() 54 54 : base() { 55 Parameters.Add(new LookupParameter<Bool Data>("Condition", "A boolean variable which defines which branch is executed."));55 Parameters.Add(new LookupParameter<BoolValue>("Condition", "A boolean variable which defines which branch is executed.")); 56 56 Parameters.Add(new OperatorParameter("TrueBranch", "The operator which is executed if the condition is true.")); 57 57 Parameters.Add(new OperatorParameter("FalseBranch", "The operator which is executed if the condition is false.")); -
trunk/sources/HeuristicLab.Operators/3.3/DoubleCounter.cs
r3017 r3048 33 33 [Creatable("Test")] 34 34 public sealed class DoubleCounter : SingleSuccessorOperator { 35 public LookupParameter<Double Data> ValueParameter {36 get { return (LookupParameter<Double Data>)Parameters["Value"]; }35 public LookupParameter<DoubleValue> ValueParameter { 36 get { return (LookupParameter<DoubleValue>)Parameters["Value"]; } 37 37 } 38 public ValueLookupParameter<Double Data> IncrementParameter {39 get { return (ValueLookupParameter<Double Data>)Parameters["Increment"]; }38 public ValueLookupParameter<DoubleValue> IncrementParameter { 39 get { return (ValueLookupParameter<DoubleValue>)Parameters["Increment"]; } 40 40 } 41 public Double DataIncrement {41 public DoubleValue Increment { 42 42 get { return IncrementParameter.Value; } 43 43 set { IncrementParameter.Value = value; } … … 46 46 public DoubleCounter() 47 47 : base() { 48 Parameters.Add(new LookupParameter<Double Data>("Value", "The value which should be incremented."));49 Parameters.Add(new ValueLookupParameter<Double Data>("Increment", "The increment which is added to the value.", new DoubleData(1)));48 Parameters.Add(new LookupParameter<DoubleValue>("Value", "The value which should be incremented.")); 49 Parameters.Add(new ValueLookupParameter<DoubleValue>("Increment", "The increment which is added to the value.", new DoubleValue(1))); 50 50 } 51 51 52 52 public override IOperation Apply() { 53 if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new Double Data();53 if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new DoubleValue(); 54 54 ValueParameter.ActualValue.Value += IncrementParameter.ActualValue.Value; 55 55 return base.Apply(); -
trunk/sources/HeuristicLab.Operators/3.3/IntCounter.cs
r3017 r3048 33 33 [Creatable("Test")] 34 34 public sealed class IntCounter : SingleSuccessorOperator { 35 public LookupParameter<Int Data> ValueParameter {36 get { return (LookupParameter<Int Data>)Parameters["Value"]; }35 public LookupParameter<IntValue> ValueParameter { 36 get { return (LookupParameter<IntValue>)Parameters["Value"]; } 37 37 } 38 public ValueLookupParameter<Int Data> IncrementParameter {39 get { return (ValueLookupParameter<Int Data>)Parameters["Increment"]; }38 public ValueLookupParameter<IntValue> IncrementParameter { 39 get { return (ValueLookupParameter<IntValue>)Parameters["Increment"]; } 40 40 } 41 public Int DataIncrement {41 public IntValue Increment { 42 42 get { return IncrementParameter.Value; } 43 43 set { IncrementParameter.Value = value; } … … 46 46 public IntCounter() 47 47 : base() { 48 Parameters.Add(new LookupParameter<Int Data>("Value", "The value which should be incremented."));49 Parameters.Add(new ValueLookupParameter<Int Data>("Increment", "The increment which is added to the value.", new IntData(1)));48 Parameters.Add(new LookupParameter<IntValue>("Value", "The value which should be incremented.")); 49 Parameters.Add(new ValueLookupParameter<IntValue>("Increment", "The increment which is added to the value.", new IntValue(1))); 50 50 } 51 51 52 52 public override IOperation Apply() { 53 if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new Int Data();53 if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new IntValue(); 54 54 ValueParameter.ActualValue.Value += IncrementParameter.ActualValue.Value; 55 55 return base.Apply(); -
trunk/sources/HeuristicLab.Operators/3.3/StochasticBranch.cs
r3017 r3048 36 36 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 37 37 } 38 public ValueLookupParameter<Double Data> ProbabilityParameter {39 get { return (ValueLookupParameter<Double Data>)Parameters["Probability"]; }38 public ValueLookupParameter<DoubleValue> ProbabilityParameter { 39 get { return (ValueLookupParameter<DoubleValue>)Parameters["Probability"]; } 40 40 } 41 41 protected OperatorParameter FirstBranchParameter { … … 57 57 : base() { 58 58 Parameters.Add(new LookupParameter<IRandom>("Random", "A pseudo random number generator.")); 59 Parameters.Add(new ValueLookupParameter<Double Data>("Probability", "The probability to execute the first branch."));59 Parameters.Add(new ValueLookupParameter<DoubleValue>("Probability", "The probability to execute the first branch.")); 60 60 Parameters.Add(new OperatorParameter("FirstBranch", "The operator which is executed with the given probability.")); 61 61 Parameters.Add(new OperatorParameter("SecondBranch", "The operator which is executed if the first branch is not executed.")); -
trunk/sources/HeuristicLab.Operators/3.3/SubScopesCreator.cs
r3017 r3048 33 33 [Creatable("Test")] 34 34 public class SubScopesCreator : SingleSuccessorOperator { 35 public ValueLookupParameter<Int Data> NumberOfSubScopesParameter {36 get { return (ValueLookupParameter<Int Data>)Parameters["NumberOfSubScopes"]; }35 public ValueLookupParameter<IntValue> NumberOfSubScopesParameter { 36 get { return (ValueLookupParameter<IntValue>)Parameters["NumberOfSubScopes"]; } 37 37 } 38 38 protected ScopeParameter CurrentScopeParameter { … … 45 45 public SubScopesCreator() 46 46 : base() { 47 Parameters.Add(new ValueLookupParameter<Int Data>("NumberOfSubScopes", "The number of new and empty sub-scopes which should be added to the current scope."));47 Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSubScopes", "The number of new and empty sub-scopes which should be added to the current scope.")); 48 48 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope to which the new and empty sub-scopes are added.")); 49 49 } -
trunk/sources/HeuristicLab.Operators/3.3/SubScopesRemover.cs
r3017 r3048 33 33 [Creatable("Test")] 34 34 public sealed class SubScopesRemover : SingleSuccessorOperator { 35 private ValueParameter<Bool Data> RemoveAllSubScopesParameter {36 get { return (ValueParameter<Bool Data>)Parameters["RemoveAllSubScopes"]; }35 private ValueParameter<BoolValue> RemoveAllSubScopesParameter { 36 get { return (ValueParameter<BoolValue>)Parameters["RemoveAllSubScopes"]; } 37 37 } 38 public ValueLookupParameter<Int Data> SubScopeIndexParameter {39 get { return (ValueLookupParameter<Int Data>)Parameters["SubScopeIndex"]; }38 public ValueLookupParameter<IntValue> SubScopeIndexParameter { 39 get { return (ValueLookupParameter<IntValue>)Parameters["SubScopeIndex"]; } 40 40 } 41 41 private ScopeParameter CurrentScopeParameter { … … 53 53 public SubScopesRemover() 54 54 : base() { 55 Parameters.Add(new ValueParameter<Bool Data>("RemoveAllSubScopes", "True if all sub-scopes of the current scope should be removed, otherwise false.", new BoolData(true)));56 Parameters.Add(new ValueLookupParameter<Int Data>("SubScopeIndex", "The index of the sub-scope which should be removed. This parameter is ignored, if RemoveAllSubScopes is true."));55 Parameters.Add(new ValueParameter<BoolValue>("RemoveAllSubScopes", "True if all sub-scopes of the current scope should be removed, otherwise false.", new BoolValue(true))); 56 Parameters.Add(new ValueLookupParameter<IntValue>("SubScopeIndex", "The index of the sub-scope which should be removed. This parameter is ignored, if RemoveAllSubScopes is true.")); 57 57 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope from which one or all sub-scopes should be removed.")); 58 58 } -
trunk/sources/HeuristicLab.Operators/3.3/SubScopesSorter.cs
r3017 r3048 36 36 private string actualName; 37 37 38 public SubScopesLookupParameter<Double Data> ValueParameter {39 get { return (SubScopesLookupParameter<Double Data>)Parameters["Value"]; }38 public SubScopesLookupParameter<DoubleValue> ValueParameter { 39 get { return (SubScopesLookupParameter<DoubleValue>)Parameters["Value"]; } 40 40 } 41 public ValueLookupParameter<Bool Data> DescendingParameter {42 get { return (ValueLookupParameter<Bool Data>)Parameters["Descending"]; }41 public ValueLookupParameter<BoolValue> DescendingParameter { 42 get { return (ValueLookupParameter<BoolValue>)Parameters["Descending"]; } 43 43 } 44 44 private ScopeParameter CurrentScopeParameter { … … 51 51 public SubScopesSorter() 52 52 : base() { 53 Parameters.Add(new SubScopesLookupParameter<Double Data>("Value", "The values contained in each sub-scope acording which the sub-scopes of the current scope are sorted."));54 Parameters.Add(new ValueLookupParameter<Bool Data>("Descending", "True if the sub-scopes should be sorted in descending order, otherwise false."));53 Parameters.Add(new SubScopesLookupParameter<DoubleValue>("Value", "The values contained in each sub-scope acording which the sub-scopes of the current scope are sorted.")); 54 Parameters.Add(new ValueLookupParameter<BoolValue>("Descending", "True if the sub-scopes should be sorted in descending order, otherwise false.")); 55 55 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope whose sub-scopes are sorted.")); 56 56 } … … 58 58 public override IOperation Apply() { 59 59 descending = DescendingParameter.ActualValue.Value; 60 actualName = LookupParameter<ItemArray<Double Data>>.TranslateName(ValueParameter.Name, ExecutionContext);60 actualName = LookupParameter<ItemArray<DoubleValue>>.TranslateName(ValueParameter.Name, ExecutionContext); 61 61 CurrentScope.SubScopes.Sort(SortScopes); 62 62 return base.Apply(); … … 75 75 return -1; 76 76 else { 77 int result = ((Double Data)var1.Value).CompareTo((DoubleData)var2.Value);77 int result = ((DoubleValue)var1.Value).CompareTo((DoubleValue)var2.Value); 78 78 if (descending) result = result * -1; 79 79 return result;
Note: See TracChangeset
for help on using the changeset viewer.