Example #1
0
        public override bool IncrementToken()
        {
            if (input.IncrementToken())
            {
                // capture state lazily - maybe no SinkFilter accepts this state
                AttributeSource.State state = null;
                for (System.Collections.IEnumerator it = sinks.GetEnumerator(); it.MoveNext();)
                {
                    SinkTokenStream sink = (SinkTokenStream)((System.WeakReference)it.Current).Target;
                    if (sink != null)
                    {
                        if (sink.Accept(this))
                        {
                            if (state == null)
                            {
                                state = this.CaptureState();
                            }
                            sink.AddState(state);
                        }
                    }
                }
                return(true);
            }

            return(false);
        }
Example #2
0
 internal /*private*/ void  AddState(AttributeSource.State state)
 {
     if (it != null)
     {
         throw new System.SystemException("The tee must be consumed before sinks are consumed.");
     }
     cachedStates.Add(state);
 }
Example #3
0
 private void  FillCache()
 {
     while (input.IncrementToken())
     {
         cache.Add(CaptureState());
     }
     // capture final state
     input.End();
     finalState = CaptureState();
 }
Example #4
0
 public override void  End()
 {
     base.End();
     AttributeSource.State finalState = CaptureState();
     for (System.Collections.IEnumerator it = sinks.GetEnumerator(); it.MoveNext();)
     {
         SinkTokenStream sink = (SinkTokenStream)((System.WeakReference)it.Current).Target;
         if (sink != null)
         {
             sink.SetFinalState(finalState);
         }
     }
 }
Example #5
0
            public override bool IncrementToken()
            {
                // lazy init the iterator
                if (it == null)
                {
                    it = cachedStates.GetEnumerator();
                }

                if (!it.MoveNext())
                {
                    return(false);
                }

                AttributeSource.State state = (State)it.Current;
                RestoreState(state);
                return(true);
            }
Example #6
0
		private void  FillCache()
		{
			while (input.IncrementToken())
			{
				cache.Add(CaptureState());
			}
			// capture final state
			input.End();
			finalState = CaptureState();
		}
Example #7
0
			internal /*private*/ void  SetFinalState(AttributeSource.State finalState)
			{
				this.finalState = finalState;
			}
Example #8
0
 internal /*private*/ void  SetFinalState(AttributeSource.State finalState)
 {
     this.finalState = finalState;
 }