Exemplo n.º 1
0
        public Transition(ExploitationPrimitive primitive, ExploitationTechnique technique, bool isRootTransition)
        {
            this.Primitive        = primitive;
            this.Technique        = technique;
            this.IsRootTransition = isRootTransition;

            List <TransitionConstraint> compiledConstraints = new List <TransitionConstraint>();

            foreach (Expression <Func <SimulationContext, bool> > constraintExpr in primitive.ConstraintList)
            {
                compiledConstraints.Add(new TransitionConstraint()
                {
                    ConstraintExpression = constraintExpr,
                    CompiledConstraint   = constraintExpr.Compile()
                });
            }

            this.Constraints = compiledConstraints;

            this.OnSuccess = (context) =>
            {
                Violation v = this.Primitive.GetNextViolation(context);

                this.Primitive.NotifyOnSuccess(context, ref v);

                return(v);
            };
        }
Exemplo n.º 2
0
 public Transition AddRootTransition(
     ExploitationTechnique technique,
     ExploitationPrimitive primitive
     )
 {
     return(AddTransition(technique, primitive, true));
 }
Exemplo n.º 3
0
        public Transition AddTransition(
            ExploitationTechnique technique,
            ExploitationPrimitive primitive,
            bool isRootTransition = false
            )
        {
            Transition transition;

            transition = new Transition(primitive, technique, isRootTransition)
            {
                Ordinal = ++this.TransitionOrdinalPool
            };

            this.Transitions.Add(transition);

            if (this.SkipUpdateGraph == false)
            {
                UpdateGraphs();
            }

            return(transition);
        }