Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/08 02:08:02 (17 years ago)
Author:
swagner
Message:

Worked on ticket #41

  • added generic ItemList<T>
Location:
trunk/sources/HeuristicLab.Operators
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators/CombinedOperator.cs

    r2 r40  
    4747      GetVariableInfo("InjectSubOperators").Local = true;
    4848      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));
    5050      GetVariableInfo("SubOperatorNames").Local = true;
    51       ItemList subOperatorNames = new ItemList();
    52       subOperatorNames.ItemType = typeof(StringData);
     51      ItemList<StringData> subOperatorNames = new ItemList<StringData>();
    5352      AddVariable(new Variable("SubOperatorNames", subOperatorNames));
    5453    }
     
    7574        bool inject = GetVariableValue<BoolData>("InjectSubOperators", scope, false).Data;
    7675        if (inject) {
    77           ItemList names = GetVariableValue<ItemList>("SubOperatorNames", scope, false);
     76          ItemList<StringData> names = GetVariableValue<ItemList<StringData>>("SubOperatorNames", scope, false);
    7877          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]));
    8281          }
    8382        }
  • trunk/sources/HeuristicLab.Operators/DataCollector.cs

    r2 r40  
    3333
    3434    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);
    3636      variableNamesVariableInfo.Local = true;
    3737      AddVariableInfo(variableNamesVariableInfo);
    38       ItemList variableNames = new ItemList();
    39       variableNames.ItemType = typeof(StringData);
     38      ItemList<StringData> variableNames = new ItemList<StringData>();
    4039      AddVariable(new Variable("VariableNames", variableNames));
    4140      AddVariableInfo(new VariableInfo("Values", "Collected values", typeof(ItemList), VariableKind.New | VariableKind.In | VariableKind.Out));
     
    4342
    4443    public override IOperation Apply(IScope scope) {
    45       ItemList names = GetVariableValue<ItemList>("VariableNames", scope, false);
     44      ItemList<StringData> names = GetVariableValue<ItemList<StringData>>("VariableNames", scope, false);
    4645      ItemList values = GetVariableValue<ItemList>("Values", scope, false, false);
    4746      if (values == null) {
     
    5655      ItemList currentValues = new ItemList();
    5756      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());
    5958      values.Add(currentValues);
    6059      return null;
Note: See TracChangeset for help on using the changeset viewer.