public TerminationOperator() : base() { Parameters.Add(new LookupParameter <ITerminator>("Terminator", "The termination criteria which sould be checked.")); Parameters.Add(new LookupParameter <BoolValue>("Terminate", "The parameter which will be set to determine if execution should be terminated or schould continue.")); Parameters.Add(new OperatorParameter("ContinueBranch", "The operator which is executed if no termination criteria has met.")); Parameters.Add(new OperatorParameter("TerminateBranch", "The operator which is executed if any termination criteria has met.")); var assigner = new Assigner() { Name = "Terminate = false" }; assigner.LeftSideParameter.ActualName = TerminateParameter.Name; assigner.RightSideParameter.Value = new BoolValue(false); var placeholder = new Placeholder() { Name = "Check termination criteria (Placeholder)" }; placeholder.OperatorParameter.ActualName = TerminatorParameter.Name; BeforeExecutionOperators.Add(assigner); BeforeExecutionOperators.Add(placeholder); }
public sealed override IOperation Apply() { //to speed up the execution call instrumented apply directly if no before operators exists if (!BeforeExecutionOperators.Any()) { return(InstrumentedApply()); } //build before operations var opCol = new OperationCollection(); foreach (var beforeAction in BeforeExecutionOperators) { var beforeActionOperation = ExecutionContext.CreateChildOperation(beforeAction); opCol.Add(beforeActionOperation); } //build operation for the instrumented apply opCol.Add(CreateInstrumentedOperation(this)); return(opCol); }