/// <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 <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 for (System.Collections.IEnumerator it = this.CloneAttributes().GetAttributeImplsIterator(); it.MoveNext(); ) { sink.AddAttributeImpl((AttributeImpl) it.Current); } this.sinks.Add(new System.WeakReference(sink)); }