public ParallelPathItem(ParallelPathItem prev, ITlaState state, ITlaTransition fromTransition, ITlaState checkerState, ITlaTransition checkerFromTransition) : base(state, prev, fromTransition) { this.Prev = prev; this.CheckerState = checkerState; this.CheckerFromTransition = checkerFromTransition; this.Length = prev == null ? 1 : prev.Length; }
private PathItem RunChecker(ITlaState from, ITlaState checker, int limit) { var stack = new Stack <ParallelPathItem>(); stack.Push(new ParallelPathItem(null, from, null, checker, null)); Console.WriteLine("Running checker from {0}", from.Name); while (stack.Count > 0) { var item = stack.Pop(); if (item.CheckerState.IsAccepting && item.State.IsAccepting) { return(item); } foreach (var modelTransition in item.State.Outgoings) { foreach (var checkerTransition in item.CheckerState.Outgoings) { if (this.TransitionConditionsIntersects(item.State, modelTransition.Condition, checkerTransition.Condition)) { if (!item.IsAny(modelTransition.ToState) && !item.IsCheckersAny(checkerTransition.ToState)) { var newItem = new ParallelPathItem(item, modelTransition.ToState, modelTransition, checkerTransition.ToState, checkerTransition); Console.WriteLine("\t{0}({1}) -> {2}({3})", item.State, item.CheckerState, newItem.State, newItem.CheckerState); if (newItem.Length % limit == 0) { Console.WriteLine("Traverse depth warning: {0}! Press any key to continue, B to break particular path, A to abort traversing.", newItem.Length); switch (Console.ReadKey().Key) { case ConsoleKey.B: continue; case ConsoleKey.A: return(null); } } stack.Push(newItem); } } } } } return(null); }