예제 #1
0
 public PathInfo([NotNull] Item root, bool rootIsCounted, [CanBeNull] IMatchableObject countedObject,
                 [CanBeNull] PathNode tail)
 {
     Root          = root;
     RootIsCounted = rootIsCounted;
     CountedObject = countedObject;
     Tail          = tail;
 }
예제 #2
0
            protected override DownAndHere AfterPushDependency(Stack <TDependency> currentPath, int expectedPathMatchIndex,
                                                               AbstractPathMatch <TDependency, TItem> pathMatchOrNull, bool isEnd, DownInfo down)
            {
                TDependency tailDependency = currentPath.Peek();
                TItem       usedItem       = tailDependency.UsedItem;

                if (down.BehindCountMatch != null)
                {
                    if (!Counts.ContainsKey(usedItem))
                    {
                        Counts[usedItem] = new HashSet <IMatchableObject>();
                    }
                    Counts[usedItem].Add(down.BehindCountMatch);
                }
                _seenInnerPathStarts.Add(usedItem);

                IMatchableObject pushDownMatch = null;
                bool             dependencyMatchedByCountMatch = false;
                bool             usedItemMatchedByCountMatch   = false;

                if (down.BehindCountMatch != null)
                {
                    pushDownMatch = down.BehindCountMatch;
                }
                else if (_countMatch == null)
                {
                    // default values are ok
                }
                else if (_countMatch == pathMatchOrNull)
                {
                    if (_countMatch is DependencyPathMatch <TDependency, TItem> )
                    {
                        pushDownMatch = tailDependency;
                        dependencyMatchedByCountMatch = true;
                    }
                    else
                    {
                        pushDownMatch = usedItem;
                        usedItemMatchedByCountMatch = true;
                    }
                }
                else
                {
                    // default values are ok
                }
                return(new DownAndHere(new DownInfo(pushDownMatch), new HereInfo(dependencyMatchedByCountMatch, usedItemMatchedByCountMatch)));
            }
예제 #3
0
 public DownInfo(IMatchableObject behindCountMatch)
 {
     BehindCountMatch = behindCountMatch;
 }