示例#1
0
            protected DfaState(TDfaState state)
            {
                Nodes           = state.Nodes;
                LazyTransitions = state.LazyTransitions;

                HashCode        = state.HashCode;
                SuccessSubGraph = state.PrevSuccessTransition?.SubGraph;
                Break           = true;
                Builder         = state.Builder;
            }
示例#2
0
            protected DfaState(DfaNode[] nodes, DfaTransition[] lazyTransitions, DfaTransition successTransition, DfaTransition prevSuccessTransition, int hashCode, DfaBuilder <TDfaState> builder)
            {
                Index = builder.Register((TDfaState)this);
                Array = builder.FastLookup ? new TDfaState[ArrayLimit] : System.Array.Empty <TDfaState>();

                Dictionary = new DfaDictionary <TDfaState>();
                Builder    = builder;

                Nodes                 = nodes;
                LazyTransitions       = lazyTransitions;
                HashCode              = hashCode;
                SuccessTransition     = successTransition;
                PrevSuccessTransition = prevSuccessTransition;
                SuccessSubGraph       = SuccessTransition?.SubGraph;

                if (SuccessSubGraph != null)
                {
                    SavePointer = true;
                }

                if (nodes.Length == 1 && SuccessTransition != null)
                {
                    var dfaNode = Nodes[0];
                    var node    = (Node)dfaNode.Node;

                    if ((node is ReturnStateNode || node.ReturnPath.IsInvalid) && node.ExecutionPaths.Length == 0)
                    {
                        Break = true;
                    }
                }

                Predicate = Nodes.FirstOrDefault(a => a.ExecutionPathObject != null)?.ExecutionPathObject;

                if (Predicate != null)
                {
                    TruePredicateArray      = builder.FastLookup ? new TDfaState[ArrayLimit] : System.Array.Empty <TDfaState>();
                    TruePredicateDictionary = new Dictionary <int, TDfaState>();

                    FalsePredicateArray      = builder.FastLookup ? new TDfaState[ArrayLimit] : System.Array.Empty <TDfaState>();
                    FalsePredicateDictionary = new Dictionary <int, TDfaState>();
                }

                // ReSharper disable once VirtualMemberCallInConstructor
                NullState = CreateNullState();

                if (SavePointer == false && Break == false && Predicate == null)
                {
                    Continue = true;
                }
            }
示例#3
0
 public DfaTransition(SubGraphBase subGraph, int lazyIndex)
 {
     SubGraph  = subGraph;
     LazyIndex = lazyIndex;
 }