public virtual void TestPayloadAttribute() { PayloadAttribute att = new PayloadAttribute(); Assert.IsNull(att.Payload); Payload pl = new Payload(new byte[]{1, 2, 3, 4}); att.Payload = pl; PayloadAttribute att2 = (PayloadAttribute) AssertCloneIsEqual(att); Assert.AreEqual(pl, att2.Payload); Assert.AreNotSame(pl, att2.Payload); att2 = (PayloadAttribute) AssertCopyIsEqual(att); Assert.AreEqual(pl, att2.Payload); Assert.AreNotSame(pl, att2.Payload); att.Clear(); Assert.IsNull(att.Payload); }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
public void SetPayload(Payload payload) { delegate_Renamed.SetPayload(payload); }
// like clear() but doesn't clear termBuffer/text private void ClearNoTermBuffer() { payload = null; positionIncrement = 1; flags = 0; startOffset = endOffset = 0; type = DEFAULT_TYPE; }
public virtual void TestPayloadAttribute() { PayloadAttributeImpl att = new PayloadAttributeImpl(); Assert.IsNull(att.GetPayload()); Payload pl = new Payload(new byte[]{1, 2, 3, 4}); att.SetPayload(pl); PayloadAttributeImpl att2 = (PayloadAttributeImpl) AssertCloneIsEqual(att); Assert.AreEqual(pl, att2.GetPayload()); Assert.AreNotSame(pl, att2.GetPayload()); att2 = (PayloadAttributeImpl) AssertCopyIsEqual(att); Assert.AreEqual(pl, att2.GetPayload()); Assert.AreNotSame(pl, att2.GetPayload()); att.Clear(); Assert.IsNull(att.GetPayload()); }
/// <summary> Sets this Token's payload.</summary> public virtual void SetPayload(Payload payload) { this.payload = payload; }
private void InitBlock() { p = new Payload(data, 0, 1); }
public virtual void TestCopyTo() { Token t = new Token(); Token copy = (Token) TestSimpleAttributeImpls.AssertCopyIsEqual(t); Assert.AreEqual("", t.Term); Assert.AreEqual("", copy.Term); t = new Token(0, 5); char[] content = "hello".ToCharArray(); t.SetTermBuffer(content, 0, 5); char[] buf = t.TermBuffer(); copy = (Token) TestSimpleAttributeImpls.AssertCopyIsEqual(t); Assert.AreEqual(t.Term, copy.Term); Assert.AreNotSame(buf, copy.TermBuffer()); Payload pl = new Payload(new byte[]{1, 2, 3, 4}); t.Payload = pl; copy = (Token) TestSimpleAttributeImpls.AssertCopyIsEqual(t); Assert.AreEqual(pl, copy.Payload); Assert.AreNotSame(pl, copy.Payload); }
public void SetPayload(Payload payload) { delegate_Renamed.SetPayload(payload); }
// like clear() but doesn't clear termBuffer/text private void ClearNoTermBuffer() { payload = null; positionIncrement = 1; flags = 0; }
/// <summary>Resets the term text, payload, and positionIncrement to default. /// Other fields such as startOffset, endOffset and the token type are /// not reset since they are normally overwritten by the tokenizer. /// </summary> public virtual void Clear() { payload = null; // Leave termBuffer to allow re-use termLength = 0; termText = null; positionIncrement = 1; // startOffset = endOffset = 0; // type = DEFAULT_TYPE; }
/// <summary> Initialize this attribute with the given payload. </summary> public PayloadAttribute(Payload payload) { this.payload = payload; }
/// <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; }
public override void Clear() { payload = null; }
/// <summary> Sets this Token's payload.</summary> public virtual void SetPayload(Payload payload) { this.payload = payload; }