/// <summary> Returns a new <see cref="SinkTokenStream" /> that receives all tokens consumed by this stream /// that pass the supplied filter. /// </summary> /// <seealso cref="SinkFilter"> /// </seealso> public SinkTokenStream NewSinkTokenStream(SinkFilter filter) { var sink = new SinkTokenStream(this.CloneAttributes(), filter); sinks.AddLast(new WeakReference(sink)); return(sink); }
/// <summary> Returns a new {@link SinkTokenStream} that receives all tokens consumed by this stream /// that pass the supplied filter. /// </summary> /// <seealso cref="SinkFilter"> /// </seealso> public SinkTokenStream NewSinkTokenStream(SinkFilter filter) { SinkTokenStream sink = new SinkTokenStream(this.CloneAttributes(), filter); this.sinks.Add(new System.WeakReference(sink)); return(sink); }
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); }
/// <summary> /// Returns a new <see cref="SinkTokenStream"/> that receives all tokens consumed by this stream /// that pass the supplied filter. </summary> /// <seealso cref="SinkFilter"/> public SinkTokenStream NewSinkTokenStream(SinkFilter filter) { var sink = new SinkTokenStream(CloneAttributes(), filter); this.sinks.Add(new WeakReference <SinkTokenStream>(sink)); return(sink); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override public boolean incrementToken() throws java.io.IOException public override bool incrementToken() { if (input.incrementToken()) { // capture state lazily - maybe no SinkFilter accepts this state AttributeSource.State state = null; foreach (WeakReference <SinkTokenStream> @ref in sinks) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final SinkTokenStream sink = ref.get(); SinkTokenStream sink = @ref.get(); if (sink != null) { if (sink.accept(this)) { if (state == null) { state = this.captureState(); } sink.addState(state); } } } return(true); } return(false); }
public override bool IncrementToken() { if (input.IncrementToken()) { // capture state lazily - maybe no SinkFilter accepts this state AttributeSource.State state = null; foreach (WeakReference wr in sinks) { SinkTokenStream sink = (SinkTokenStream)wr.Target; if (sink != null) { if (sink.Accept(this)) { if (state == null) { state = this.CaptureState(); } sink.AddState(state); } } } return(true); } return(false); }
/// <summary> /// Returns a new <seealso cref="SinkTokenStream"/> that receives all tokens consumed by this stream /// that pass the supplied filter. </summary> /// <seealso cref= SinkFilter </seealso> public SinkTokenStream newSinkTokenStream(SinkFilter filter) { SinkTokenStream sink = new SinkTokenStream(this.cloneAttributes(), filter); this.sinks.Add(new WeakReference <>(sink)); return(sink); }
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 void End() { base.End(); AttributeSource.State finalState = CaptureState(); foreach (WeakReference wr in sinks) { SinkTokenStream sink = (SinkTokenStream)wr.Target; if (sink != null) { sink.SetFinalState(finalState); } } }
/// <summary> /// Adds a <see cref="SinkTokenStream"/> created by another <see cref="TeeSinkTokenFilter"/> /// to this one. The supplied stream will also receive all consumed tokens. /// This method can be used to pass tokens from two different tees to one sink. /// </summary> public void AddSinkTokenStream(SinkTokenStream sink) { // check that sink has correct factory if (!GetAttributeFactory().Equals(sink.GetAttributeFactory())) { throw new ArgumentException("The supplied sink is not compatible to this tee"); } // add eventually missing attribute impls to the existing sink for (var it = CloneAttributes().GetAttributeImplsEnumerator(); it.MoveNext();) { sink.AddAttributeImpl(it.Current); } this.sinks.Add(new WeakReference <SinkTokenStream>(sink)); }
/// <summary> Adds a {@link SinkTokenStream} created by another <code>TeeSinkTokenFilter</code> /// to this one. The supplied stream will also receive all consumed tokens. /// This method can be used to pass tokens from two different tees to one sink. /// </summary> public void AddSinkTokenStream(SinkTokenStream sink) { // check that sink has correct factory if (!this.GetAttributeFactory().Equals(sink.GetAttributeFactory())) { throw new System.ArgumentException("The supplied sink is not compatible to this tee"); } // add eventually missing attribute impls to the existing sink foreach (AttributeImpl impl in this.CloneAttributes().GetAttributeImplsIterator()) { sink.AddAttributeImpl(impl); } this.sinks.Add(new System.WeakReference(sink)); }
/// <summary> /// Adds a <seealso cref="SinkTokenStream"/> created by another <code>TeeSinkTokenFilter</code> /// to this one. The supplied stream will also receive all consumed tokens. /// This method can be used to pass tokens from two different tees to one sink. /// </summary> //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: public void addSinkTokenStream(final SinkTokenStream sink) public void addSinkTokenStream(SinkTokenStream sink) { // check that sink has correct factory if (!this.AttributeFactory.Equals(sink.AttributeFactory)) { throw new System.ArgumentException("The supplied sink is not compatible to this tee"); } // add eventually missing attribute impls to the existing sink for (IEnumerator <AttributeImpl> it = this.cloneAttributes().AttributeImplsIterator; it.MoveNext();) { sink.addAttributeImpl(it.Current); } this.sinks.Add(new WeakReference <>(sink)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override public final void end() throws java.io.IOException public override void end() { base.end(); AttributeSource.State finalState = captureState(); foreach (WeakReference <SinkTokenStream> @ref in sinks) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final SinkTokenStream sink = ref.get(); SinkTokenStream sink = @ref.get(); if (sink != null) { sink.FinalState = finalState; } } }
/// <summary> Returns a new {@link SinkTokenStream} that receives all tokens consumed by this stream /// that pass the supplied filter. /// </summary> /// <seealso cref="SinkFilter"> /// </seealso> public SinkTokenStream NewSinkTokenStream(SinkFilter filter) { SinkTokenStream sink = new SinkTokenStream(this.CloneAttributes(), filter); this.sinks.Add(new System.WeakReference(sink)); return sink; }
/// <summary> Adds a {@link SinkTokenStream} created by another <code>TeeSinkTokenFilter</code> /// to this one. The supplied stream will also receive all consumed tokens. /// This method can be used to pass tokens from two different tees to one sink. /// </summary> public void AddSinkTokenStream(SinkTokenStream sink) { // check that sink has correct factory if (!this.GetAttributeFactory().Equals(sink.GetAttributeFactory())) { throw new System.ArgumentException("The supplied sink is not compatible to this tee"); } // add eventually missing attribute impls to the existing sink for (System.Collections.IEnumerator it = this.CloneAttributes().GetAttributeImplsIterator(); it.MoveNext(); ) { sink.AddAttributeImpl((AttributeImpl) it.Current); } this.sinks.Add(new System.WeakReference(sink)); }
/// <summary> Adds a <see cref="SinkTokenStream" /> created by another <c>TeeSinkTokenFilter</c> /// to this one. The supplied stream will also receive all consumed tokens. /// This method can be used to pass tokens from two different tees to one sink. /// </summary> public void AddSinkTokenStream(SinkTokenStream sink) { // check that sink has correct factory if (!this.Factory.Equals(sink.Factory)) { throw new System.ArgumentException("The supplied sink is not compatible to this tee"); } // add eventually missing attribute impls to the existing sink foreach (var impl in this.CloneAttributes().GetAttributeImplsIterator()) { sink.AddAttributeImpl(impl); } sinks.AddLast(new WeakReference(sink)); }
/// <summary> /// Returns a new <seealso cref="SinkTokenStream"/> that receives all tokens consumed by this stream /// that pass the supplied filter. </summary> /// <seealso cref= SinkFilter </seealso> public SinkTokenStream newSinkTokenStream(SinkFilter filter) { SinkTokenStream sink = new SinkTokenStream(this.cloneAttributes(), filter); this.sinks.Add(new WeakReference<>(sink)); return sink; }
/// <summary> /// Adds a <seealso cref="SinkTokenStream"/> created by another <code>TeeSinkTokenFilter</code> /// to this one. The supplied stream will also receive all consumed tokens. /// This method can be used to pass tokens from two different tees to one sink. /// </summary> //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: public void addSinkTokenStream(final SinkTokenStream sink) public void addSinkTokenStream(SinkTokenStream sink) { // check that sink has correct factory if (!this.AttributeFactory.Equals(sink.AttributeFactory)) { throw new System.ArgumentException("The supplied sink is not compatible to this tee"); } // add eventually missing attribute impls to the existing sink for (IEnumerator<AttributeImpl> it = this.cloneAttributes().AttributeImplsIterator; it.MoveNext();) { sink.addAttributeImpl(it.Current); } this.sinks.Add(new WeakReference<>(sink)); }
/// <summary> Returns a new <see cref="SinkTokenStream" /> that receives all tokens consumed by this stream /// that pass the supplied filter. /// </summary> /// <seealso cref="SinkFilter"> /// </seealso> public SinkTokenStream NewSinkTokenStream(SinkFilter filter) { var sink = new SinkTokenStream(this.CloneAttributes(), filter); sinks.AddLast(new WeakReference(sink)); return sink; }
/// <summary> /// Returns a new <seealso cref="SinkTokenStream"/> that receives all tokens consumed by this stream /// that pass the supplied filter. </summary> /// <seealso cref= SinkFilter></seealso> public SinkTokenStream NewSinkTokenStream(SinkFilter filter) { var sink = new SinkTokenStream(CloneAttributes(), filter); this.sinks.Add(new WeakReference<SinkTokenStream>(sink)); return sink; }