public override System.Object Clone() { var clone = (PayloadAttribute)base.Clone(); if (payload != null) { clone.payload = (Payload)payload.Clone(); } return(clone); // TODO: This code use to be as below. Any reason why? the if(payload!=null) was missing... //PayloadAttributeImpl impl = new PayloadAttributeImpl(); //impl.payload = new Payload(this.payload.data, this.payload.offset, this.payload.length); //return impl; }
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) { Lucene.Net.Index.Payload p = nextToken.GetPayload(); if (p != null) { nextToken.SetPayload((Lucene.Net.Index.Payload)p.Clone()); } } return(nextToken); }
public override System.Object Clone() { Token t = (Token)base.Clone(); // Do a deep clone if (termBuffer != null) { t.termBuffer = new char[termBuffer.Length]; termBuffer.CopyTo(t.termBuffer, 0); } if (payload != null) { t.payload = (Payload)payload.Clone(); } return(t); }
public virtual object Clone() { try { Token t = (Token)base.MemberwiseClone(); // Do a deep clone if (termBuffer != null) { t.termBuffer = (char[])termBuffer.Clone(); } if (payload != null) { t.SetPayload((Payload)payload.Clone()); } return(t); } catch (System.Exception e) { throw new System.SystemException("", e); // shouldn't happen } }
/// <summary>Returns the next token in the stream, or null at EOS. /// The returned Token is a "full private copy" (not /// re-used across calls to next()) but will be slower /// than calling {@link #Next(Token)} instead.. /// </summary> public virtual Token Next() { Token result = Next(new Token()); if (result != null) { Payload p = result.GetPayload(); if (p != null) { result.SetPayload((Payload)p.Clone()); } } return(result); }
/// <summary>Returns the next token in the stream, or null at EOS. /// @deprecated The returned Token is a "full private copy" (not /// re-used across calls to next()) but will be slower /// than calling {@link #Next(Token)} instead.. /// </summary> public virtual Token Next() { Token reusableToken = new Token(); Token nextToken = Next(reusableToken); if (nextToken != null) { Payload p = nextToken.GetPayload(); if (p != null) { nextToken.SetPayload((Payload)p.Clone()); } } return(nextToken); }
public virtual System.Object Clone() { try { Token t = (Token)base.MemberwiseClone(); if (termBuffer != null) { t.termBuffer = null; t.SetTermBuffer(termBuffer, 0, termLength); } if (payload != null) { t.SetPayload((Payload)payload.Clone()); } return(t); } catch (System.Exception e) { throw new System.SystemException("", e); // shouldn't happen } }
public override void CopyTo(AttributeImpl target) { PayloadAttribute t = (PayloadAttribute)target; t.SetPayload((payload == null)?null:(Payload)payload.Clone()); }