Changeset 40 for trunk/sources/HeuristicLab.Operators
- Timestamp:
- 03/05/08 02:08:02 (17 years ago)
- Location:
- trunk/sources/HeuristicLab.Operators
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Operators/CombinedOperator.cs
r2 r40 47 47 GetVariableInfo("InjectSubOperators").Local = true; 48 48 AddVariable(new Variable("InjectSubOperators", new BoolData(false))); 49 AddVariableInfo(new VariableInfo("SubOperatorNames", "Variable names for injecting the sub-operators", typeof(ItemList ), VariableKind.In));49 AddVariableInfo(new VariableInfo("SubOperatorNames", "Variable names for injecting the sub-operators", typeof(ItemList<StringData>), VariableKind.In)); 50 50 GetVariableInfo("SubOperatorNames").Local = true; 51 ItemList subOperatorNames = new ItemList(); 52 subOperatorNames.ItemType = typeof(StringData); 51 ItemList<StringData> subOperatorNames = new ItemList<StringData>(); 53 52 AddVariable(new Variable("SubOperatorNames", subOperatorNames)); 54 53 } … … 75 74 bool inject = GetVariableValue<BoolData>("InjectSubOperators", scope, false).Data; 76 75 if (inject) { 77 ItemList names = GetVariableValue<ItemList>("SubOperatorNames", scope, false);76 ItemList<StringData> names = GetVariableValue<ItemList<StringData>>("SubOperatorNames", scope, false); 78 77 for (int i = 0; i < SubOperators.Count; i++) { 79 if (scope.GetVariable(names[i]. ToString()) != null)80 scope.RemoveVariable(names[i]. ToString());81 scope.AddVariable(new Variable(names[i]. ToString(), SubOperators[i]));78 if (scope.GetVariable(names[i].Data) != null) 79 scope.RemoveVariable(names[i].Data); 80 scope.AddVariable(new Variable(names[i].Data, SubOperators[i])); 82 81 } 83 82 } -
trunk/sources/HeuristicLab.Operators/DataCollector.cs
r2 r40 33 33 34 34 public DataCollector() { 35 IVariableInfo variableNamesVariableInfo = new VariableInfo("VariableNames", "Names of variables whose values should be collected", typeof(ItemList ), VariableKind.In);35 IVariableInfo variableNamesVariableInfo = new VariableInfo("VariableNames", "Names of variables whose values should be collected", typeof(ItemList<StringData>), VariableKind.In); 36 36 variableNamesVariableInfo.Local = true; 37 37 AddVariableInfo(variableNamesVariableInfo); 38 ItemList variableNames = new ItemList(); 39 variableNames.ItemType = typeof(StringData); 38 ItemList<StringData> variableNames = new ItemList<StringData>(); 40 39 AddVariable(new Variable("VariableNames", variableNames)); 41 40 AddVariableInfo(new VariableInfo("Values", "Collected values", typeof(ItemList), VariableKind.New | VariableKind.In | VariableKind.Out)); … … 43 42 44 43 public override IOperation Apply(IScope scope) { 45 ItemList names = GetVariableValue<ItemList>("VariableNames", scope, false);44 ItemList<StringData> names = GetVariableValue<ItemList<StringData>>("VariableNames", scope, false); 46 45 ItemList values = GetVariableValue<ItemList>("Values", scope, false, false); 47 46 if (values == null) { … … 56 55 ItemList currentValues = new ItemList(); 57 56 for (int i = 0; i < names.Count; i++) 58 currentValues.Add((IItem)scope.GetVariableValue( ((StringData)names[i]).Data, true).Clone());57 currentValues.Add((IItem)scope.GetVariableValue(names[i].Data, true).Clone()); 59 58 values.Add(currentValues); 60 59 return null;
Note: See TracChangeset
for help on using the changeset viewer.