Last change
on this file since 588 was
583,
checked in by abeham, 16 years ago
|
Adding communication framework to branch 3.1 (ticket #278)
|
File size:
1.0 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Xml;
|
---|
6 | using HeuristicLab.Core;
|
---|
7 | using HeuristicLab.Data;
|
---|
8 |
|
---|
9 | namespace HeuristicLab.SimOpt {
|
---|
10 | public class SimOptParameterExtractor : OperatorBase {
|
---|
11 | public override string Description {
|
---|
12 | get { return @"Injects the contents of a ConstrainedItemList into the scope"; }
|
---|
13 | }
|
---|
14 |
|
---|
15 | public SimOptParameterExtractor()
|
---|
16 | : base() {
|
---|
17 | AddVariableInfo(new VariableInfo("Items", "The ConstrainedItemList to be extracted", typeof(ConstrainedItemList), VariableKind.In));
|
---|
18 | }
|
---|
19 |
|
---|
20 | public override IOperation Apply(IScope scope) {
|
---|
21 | ConstrainedItemList cil = GetVariableValue<ConstrainedItemList>("Items", scope, false);
|
---|
22 | for (int i = 0; i < cil.Count; i++) {
|
---|
23 | IVariable var = scope.GetVariable(((Variable)cil[i]).Name);
|
---|
24 | if (var == null) scope.AddVariable((IVariable)cil[i].Clone());
|
---|
25 | else var.Value = (IItem)((Variable)cil[i]).Value.Clone();
|
---|
26 | }
|
---|
27 | return null;
|
---|
28 | }
|
---|
29 | }
|
---|
30 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.