Ejemplo n.º 1
0
        public bool MoveNext()
        {
            throwifcompleted();
            //pass this on to the parent
            var v = parentStream.MoveNext();

            if (!v)
            {
                return(false);
            }
            //if we have a subspeculator then credit it to the subspecular
            if (hasSubSpeculator)
            {
                SubSpeculatorIndex++;
            }
            else
            {
                CurrentEventNumber++;
            }
            return(true);
        }
        //basic and container
        internal override MatchResult BeginProcessMatch(Tracker tracker, IEventStream eventenum, CaptureList CapturedList)
        {
            //container elements run thru all of the statements and apply the matches
            //when we enter here the eventenum should already be pointng at the correct event
            tracker.DebugStart(this);
            //tracker.dbgMsgs.Add(this.ToString());
            var movenextres      = true;
            var myStatementsEnum = Statements.GetEnumerator();

            //move to t he first statement
            myStatementsEnum.MoveNext();

            MatchResult res = MatchResult.None;

            while (myStatementsEnum.Current != null)
            {
                //transfer responsibility to each statement , the simple ones will just return their matches
                //the more advanced ones will take over the processing

                //if eventnum is empty

                res = myStatementsEnum.Current.BeginProcessMatch(tracker, eventenum, CapturedList);
                //if the child did not requst to forward then move the event
                if (!res.Is_Forward())
                {
                    eventenum.MoveNext();
                }
                //if i don't match - and the element is not saying continue with me , in other words there is no hope for
                //me to match not now and not in the future

                if (!res.Is_Match() && !res.Is_Continue())
                {
                    if (tracker.DebugEnabled)
                    {
                        tracker.SaveDBGResult(this, res);
                    }
                    if (!res.Is_Forward())
                    {
                    }
                    return(res);
                }
                //if the child element didn't ask to contine with its elf then move next element
                if (!res.Is_Continue())
                {
                    myStatementsEnum.MoveNext();
                }



                //if i already matched but there aren't any more statements in the events then just return a match
                if (res.Is_Match() && eventenum.Current == null)
                {
                    //return res;
                }
            }

            if (tracker.DebugEnabled)
            {
                tracker.SaveDBGResult(this, res);
            }
            //if we got here then everythign matched
            if (eventenum.Current == null)
            {
                res = res | MatchResult.Ended;
            }
            return(res);
        }