public override bool IncrementToken() { if (state != null) { RestoreState(state); payloadAtt.SetPayload(null); posIncrAtt.SetPositionIncrement(0); termAtt.SetTermBuffer(new char[] { 'b' }, 0, 1); state = null; return(true); } bool hasNext = input.IncrementToken(); if (!hasNext) { return(false); } if (System.Char.IsDigit(termAtt.TermBuffer()[0])) { posIncrAtt.SetPositionIncrement(termAtt.TermBuffer()[0] - '0'); } if (first) { // set payload on first position only payloadAtt.SetPayload(new Payload(new byte[] { 100 })); first = false; } // index a "synonym" for every token state = CaptureState(); return(true); }
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); }
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); }
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 void End() { base.End(); AttributeSource.State finalState = CaptureState(); foreach (WeakReference wr in sinks) { SinkTokenStream sink = (SinkTokenStream)wr.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); }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param>NA</param> /// <returns></returns> public override bool IncrementToken() { if (synonymStack.Count > 0) { String syn = synonymStack.Pop(); RestoreState(current); termAtt.SetTermBuffer(syn); posIncrAtt.PositionIncrement = 0; return(true); } if (!input.IncrementToken()) { return(false); } if (addAliasesToStack()) { current = CaptureState(); } return(true); }
public override bool IncrementToken() { if (state != null) { RestoreState(state); payloadAtt.SetPayload(null); posIncrAtt.SetPositionIncrement(0); termAtt.SetTermBuffer(new char[]{'b'}, 0, 1); state = null; return true; } bool hasNext = input.IncrementToken(); if (!hasNext) return false; if (System.Char.IsDigit(termAtt.TermBuffer()[0])) { posIncrAtt.SetPositionIncrement(termAtt.TermBuffer()[0] - '0'); } if (first) { // set payload on first position only payloadAtt.SetPayload(new Payload(new byte[]{100})); first = false; } // index a "synonym" for every token state = CaptureState(); return true; }
private void FillCache() { while (input.IncrementToken()) { Cache.AddLast(CaptureState()); } // capture final state input.End(); FinalState = CaptureState(); }
internal /*private*/ void SetFinalState(AttributeSource.State finalState) { this.finalState = finalState; }
/*private*/ internal void SetFinalState(AttributeSource.State finalState) { this.finalState = finalState; }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param>NA</param> /// <returns></returns> public override bool IncrementToken() { if (synonymStack.Count > 0) { String syn = synonymStack.Pop(); RestoreState(current); termAtt.SetTermBuffer(syn); posIncrAtt.PositionIncrement=0; return true; } if (!input.IncrementToken()) return false; if (addAliasesToStack()) { current = CaptureState(); } return true; }
public override sealed void Reset() { base.Reset(); first = true; state = null; }
public override sealed bool IncrementToken() { if (state != null) { RestoreState(state); payloadAtt.Payload = null; posIncrAtt.PositionIncrement = 0; termAtt.SetEmpty().Append("b"); state = null; return true; } bool hasNext = input.IncrementToken(); if (!hasNext) { return false; } if (char.IsDigit(termAtt.Buffer()[0])) { posIncrAtt.PositionIncrement = termAtt.Buffer()[0] - '0'; } if (first) { // set payload on first position only payloadAtt.Payload = new BytesRef(new byte[] { 100 }); first = false; } // index a "synonym" for every token state = CaptureState(); return true; }