예제 #1
0
        private void AddWorkUnits(SimulationContext parentContext, Violation newViolation = null)
        {
            Violation currentViolation = parentContext.CurrentViolation;

            //
            // Establish the contexts that should be simulated against.
            //

            SimulationContext newContext;

            if (newViolation != null)
            {
                newContext = parentContext.CloneCast();
                newContext.CurrentViolation = newViolation;
                newContext.ParentContext    = parentContext;

                //
                // Have we reached a fixed point?
                //

                //if (newContext.HasPreviousContext(newContext))
                //{
                //    return;
                //}
            }
            else
            {
                newContext = parentContext;
                newContext.ParentContext = null;
            }

            //
            // Inherit the initial assumptions for the current violation.
            //

            foreach (Assumption assumption in newContext.CurrentViolation.Assumptions)
            {
                newContext.Assume(assumption);
            }

            this.WorkUnitQueue.Enqueue(new WorkUnit()
            {
                Context = newContext
            });
        }