Example #1
0
        public virtual Token Next()
        {
            if (tokenWrapper == null)
            {
                throw new System.NotSupportedException("This TokenStream only supports the new Attributes API.");
            }

            Token nextToken;

            if (supportedMethods.hasIncrementToken)
            {
                Token savedDelegate = tokenWrapper.delegate_Renamed;
                tokenWrapper.delegate_Renamed = new Token();
                nextToken = IncrementToken()?tokenWrapper.delegate_Renamed:null;
                tokenWrapper.delegate_Renamed = savedDelegate;
            }
            else
            {
                System.Diagnostics.Debug.Assert(supportedMethods.hasReusableNext);
                nextToken = Next(new Token());
            }

            if (nextToken != null)
            {
                Mono.Lucene.Net.Index.Payload p = nextToken.GetPayload();
                if (p != null)
                {
                    nextToken.SetPayload((Mono.Lucene.Net.Index.Payload)p.Clone());
                }
            }
            return(nextToken);
        }
Example #2
0
 // like clear() but doesn't clear termBuffer/text
 private void  ClearNoTermBuffer()
 {
     payload           = null;
     positionIncrement = 1;
     flags             = 0;
     startOffset       = endOffset = 0;
     type = DEFAULT_TYPE;
 }
Example #3
0
 /// <summary> Copy the prototype token's fields into this one, with a different term. Note: Payloads are shared.</summary>
 /// <param name="prototype">
 /// </param>
 /// <param name="newTermBuffer">
 /// </param>
 /// <param name="offset">
 /// </param>
 /// <param name="length">
 /// </param>
 public virtual void  Reinit(Token prototype, char[] newTermBuffer, int offset, int length)
 {
     SetTermBuffer(newTermBuffer, offset, length);
     positionIncrement = prototype.positionIncrement;
     flags             = prototype.flags;
     startOffset       = prototype.startOffset;
     endOffset         = prototype.endOffset;
     type    = prototype.type;
     payload = prototype.payload;
 }
Example #4
0
 /// <summary> Copy the prototype token's fields into this one, with a different term. Note: Payloads are shared.</summary>
 /// <param name="prototype">
 /// </param>
 /// <param name="newTerm">
 /// </param>
 public virtual void  Reinit(Token prototype, System.String newTerm)
 {
     SetTermBuffer(newTerm);
     positionIncrement = prototype.positionIncrement;
     flags             = prototype.flags;
     startOffset       = prototype.startOffset;
     endOffset         = prototype.endOffset;
     type    = prototype.type;
     payload = prototype.payload;
 }
Example #5
0
 /// <summary>Shorthand for calling {@link #clear},
 /// {@link #SetTermBuffer(char[], int, int)},
 /// {@link #setStartOffset},
 /// {@link #setEndOffset},
 /// {@link #setType}
 /// </summary>
 /// <returns> this Token instance
 /// </returns>
 public virtual Token Reinit(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, System.String newType)
 {
     ClearNoTermBuffer();
     payload           = null;
     positionIncrement = 1;
     SetTermBuffer(newTermBuffer, newTermOffset, newTermLength);
     startOffset = newStartOffset;
     endOffset   = newEndOffset;
     type        = newType;
     return(this);
 }
Example #6
0
 /// <summary>Resets the term text, payload, flags, and positionIncrement,
 /// startOffset, endOffset and token type to default.
 /// </summary>
 public override void  Clear()
 {
     payload = null;
     // Leave termBuffer to allow re-use
     termLength        = 0;
     termText          = null;
     positionIncrement = 1;
     flags             = 0;
     startOffset       = endOffset = 0;
     type = DEFAULT_TYPE;
 }
Example #7
0
 /// <summary> Copy the prototype token's fields into this one. Note: Payloads are shared.</summary>
 /// <param name="prototype">
 /// </param>
 public virtual void  Reinit(Token prototype)
 {
     prototype.InitTermBuffer();
     SetTermBuffer(prototype.termBuffer, 0, prototype.termLength);
     positionIncrement = prototype.positionIncrement;
     flags             = prototype.flags;
     startOffset       = prototype.startOffset;
     endOffset         = prototype.endOffset;
     type    = prototype.type;
     payload = prototype.payload;
 }
Example #8
0
 /// <summary> Initialize this attribute with the given payload. </summary>
 public PayloadAttributeImpl(Payload payload)
 {
     this.payload = payload;
 }
Example #9
0
		/// <summary> Sets this Token's payload.</summary>
		public virtual void  SetPayload(Payload payload)
		{
			this.payload = payload;
		}
Example #10
0
 /// <summary> Sets this Token's payload.</summary>
 public virtual void  SetPayload(Payload payload)
 {
     this.payload = payload;
 }
Example #11
0
		/// <summary>Resets the term text, payload, flags, and positionIncrement,
		/// startOffset, endOffset and token type to default.
		/// </summary>
		public override void  Clear()
		{
			payload = null;
			// Leave termBuffer to allow re-use
			termLength = 0;
			termText = null;
			positionIncrement = 1;
			flags = 0;
			startOffset = endOffset = 0;
			type = DEFAULT_TYPE;
		}
Example #12
0
		// like clear() but doesn't clear termBuffer/text
		private void  ClearNoTermBuffer()
		{
			payload = null;
			positionIncrement = 1;
			flags = 0;
			startOffset = endOffset = 0;
			type = DEFAULT_TYPE;
		}
Example #13
0
		public void  SetPayload(Payload payload)
		{
			delegate_Renamed.SetPayload(payload);
		}
Example #14
0
 public void  SetPayload(Payload payload)
 {
     delegate_Renamed.SetPayload(payload);
 }
Example #15
0
		public override void  Clear()
		{
			payload = null;
		}
Example #16
0
		/// <summary> Copy the prototype token's fields into this one, with a different term. Note: Payloads are shared.</summary>
		/// <param name="prototype">
		/// </param>
		/// <param name="newTermBuffer">
		/// </param>
		/// <param name="offset">
		/// </param>
		/// <param name="length">
		/// </param>
		public virtual void  Reinit(Token prototype, char[] newTermBuffer, int offset, int length)
		{
			SetTermBuffer(newTermBuffer, offset, length);
			positionIncrement = prototype.positionIncrement;
			flags = prototype.flags;
			startOffset = prototype.startOffset;
			endOffset = prototype.endOffset;
			type = prototype.type;
			payload = prototype.payload;
		}
Example #17
0
		/// <summary> Copy the prototype token's fields into this one, with a different term. Note: Payloads are shared.</summary>
		/// <param name="prototype">
		/// </param>
		/// <param name="newTerm">
		/// </param>
		public virtual void  Reinit(Token prototype, System.String newTerm)
		{
			SetTermBuffer(newTerm);
			positionIncrement = prototype.positionIncrement;
			flags = prototype.flags;
			startOffset = prototype.startOffset;
			endOffset = prototype.endOffset;
			type = prototype.type;
			payload = prototype.payload;
		}
Example #18
0
		/// <summary> Copy the prototype token's fields into this one. Note: Payloads are shared.</summary>
		/// <param name="prototype">
		/// </param>
		public virtual void  Reinit(Token prototype)
		{
			prototype.InitTermBuffer();
			SetTermBuffer(prototype.termBuffer, 0, prototype.termLength);
			positionIncrement = prototype.positionIncrement;
			flags = prototype.flags;
			startOffset = prototype.startOffset;
			endOffset = prototype.endOffset;
			type = prototype.type;
			payload = prototype.payload;
		}
Example #19
0
		/// <summary>Shorthand for calling {@link #clear},
		/// {@link #SetTermBuffer(char[], int, int)},
		/// {@link #setStartOffset},
		/// {@link #setEndOffset},
		/// {@link #setType}
		/// </summary>
		/// <returns> this Token instance 
		/// </returns>
		public virtual Token Reinit(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, System.String newType)
		{
			ClearNoTermBuffer();
			payload = null;
			positionIncrement = 1;
			SetTermBuffer(newTermBuffer, newTermOffset, newTermLength);
			startOffset = newStartOffset;
			endOffset = newEndOffset;
			type = newType;
			return this;
		}
Example #20
0
 public override void  Clear()
 {
     payload = null;
 }
Example #21
0
		/// <summary> Initialize this attribute with the given payload. </summary>
		public PayloadAttributeImpl(Payload payload)
		{
			this.payload = payload;
		}