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); }
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); }
private void FillCache() { while (input.IncrementToken()) { cache.Add(CaptureState()); } // capture final state input.End(); finalState = CaptureState(); }
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); } } }
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); }
internal /*private*/ void SetFinalState(AttributeSource.State finalState) { this.finalState = finalState; }