Last change
on this file since 583 was
583,
checked in by abeham, 16 years ago
|
Adding communication framework to branch 3.1 (ticket #278)
|
File size:
1.2 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Text;
|
---|
4 | using HeuristicLab.Core;
|
---|
5 | using HeuristicLab.Data;
|
---|
6 | using HeuristicLab.Communication.Data;
|
---|
7 |
|
---|
8 | namespace HeuristicLab.Communication.Operators {
|
---|
9 | public class CurrentStateConstraintChecker : OperatorBase {
|
---|
10 | public override string Description {
|
---|
11 | get {
|
---|
12 | return @"TODO";
|
---|
13 | }
|
---|
14 | }
|
---|
15 |
|
---|
16 | public CurrentStateConstraintChecker() {
|
---|
17 | AddVariableInfo(new VariableInfo("CurrentState", "", typeof(ProtocolState), VariableKind.In));
|
---|
18 | }
|
---|
19 |
|
---|
20 | public override IOperation Apply(IScope scope) {
|
---|
21 | ProtocolState currentState = GetVariableValue<ProtocolState>("CurrentState", scope, true);
|
---|
22 | ConstrainedItemList sendingData = (ConstrainedItemList)currentState.SendingData.Clone();
|
---|
23 | sendingData.BeginCombinedOperation();
|
---|
24 | for (int i = 0; i < sendingData.Count; i++) {
|
---|
25 | Variable tmp = (Variable)sendingData[i];
|
---|
26 | tmp.Value = scope.GetVariableValue(tmp.Name, false);
|
---|
27 | }
|
---|
28 | ICollection<IConstraint> violatedConstraints;
|
---|
29 | bool result = sendingData.EndCombinedOperation(out violatedConstraints);
|
---|
30 | if (result) return null;
|
---|
31 | else return new AtomicOperation(SubOperators[0], scope);
|
---|
32 | }
|
---|
33 | }
|
---|
34 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.