@Override public PayloadAttributeImpl clone() { PayloadAttributeImpl clone = (PayloadAttributeImpl) super.clone(); if (payload != null) { clone.payload = BytesRef.deepCopyOf(payload); } return clone; }
@Override public AttributeImpl clone() { BytesTermAttributeImpl c = (BytesTermAttributeImpl)super.clone(); copyTo(c); return c; }
@Override public State clone() { State clone = new State(); clone.attribute = attribute.clone(); if (next != null) { clone.next = next.clone(); } return clone; } }
/** * Performs a clone of all {@link AttributeImpl} instances returned in a new * {@code AttributeSource} instance. This method can be used to e.g. create another TokenStream * with exactly the same attributes (using {@link #AttributeSource(AttributeSource)}). * You can also use it as a (non-performant) replacement for {@link #captureState}, if you need to look * into / modify the captured state. */ public final AttributeSource cloneAttributes() { final AttributeSource clone = new AttributeSource(this.factory); if (hasAttributes()) { // first clone the impls for (State state = getCurrentState(); state != null; state = state.next) { clone.attributeImpls.put(state.attribute.getClass(), state.attribute.clone()); } // now the interfaces for (Entry<Class<? extends Attribute>, AttributeImpl> entry : this.attributes.entrySet()) { clone.attributes.put(entry.getKey(), clone.attributeImpls.get(entry.getValue().getClass())); } } return clone; }
@Override public CharTermAttributeImpl clone() { CharTermAttributeImpl t = (CharTermAttributeImpl)super.clone(); // Do a deep clone t.termBuffer = new char[this.termLength]; System.arraycopy(this.termBuffer, 0, t.termBuffer, 0, this.termLength); t.builder = new BytesRefBuilder(); t.builder.copyBytes(builder.get()); return t; }
@Override public PayloadAttributeImpl clone() { PayloadAttributeImpl clone = (PayloadAttributeImpl) super.clone(); if (payload != null) { clone.payload = BytesRef.deepCopyOf(payload); } return clone; }
@Override public PayloadAttributeImpl clone() { PayloadAttributeImpl clone = (PayloadAttributeImpl) super.clone(); if (payload != null) { clone.payload = payload.clone(); } return clone; }
@Override public PayloadAttributeImpl clone() { PayloadAttributeImpl clone = (PayloadAttributeImpl) super.clone(); if (payload != null) { clone.payload = BytesRef.deepCopyOf(payload); } return clone; }
@Override public AttributeImpl clone() { BytesTermAttributeImpl c = (BytesTermAttributeImpl)super.clone(); copyTo(c); return c; }
@Override public PayloadAttributeImpl clone() { PayloadAttributeImpl clone = (PayloadAttributeImpl) super.clone(); if (payload != null) { clone.payload = BytesRef.deepCopyOf(payload); } return clone; }
@Override public AttributeImpl clone() { BytesTermAttributeImpl c = (BytesTermAttributeImpl)super.clone(); copyTo(c); return c; }
@Override public State clone() { State clone = new State(); clone.attribute = attribute.clone(); if (next != null) { clone.next = next.clone(); } return clone; } }
@Override public State clone() { State clone = new State(); clone.attribute = attribute.clone(); if (next != null) { clone.next = next.clone(); } return clone; } }
@Override public State clone() { State clone = new State(); clone.attribute = attribute.clone(); if (next != null) { clone.next = next.clone(); } return clone; } }
@Override public CharTermAttributeImpl clone() { CharTermAttributeImpl t = (CharTermAttributeImpl)super.clone(); // Do a deep clone t.termBuffer = new char[this.termLength]; System.arraycopy(this.termBuffer, 0, t.termBuffer, 0, this.termLength); t.builder = new BytesRefBuilder(); t.builder.copyBytes(builder.get()); return t; }
@Override public CharTermAttributeImpl clone() { CharTermAttributeImpl t = (CharTermAttributeImpl)super.clone(); // Do a deep clone t.termBuffer = new char[this.termLength]; System.arraycopy(this.termBuffer, 0, t.termBuffer, 0, this.termLength); t.builder = new BytesRefBuilder(); t.builder.copyBytes(builder.get()); return t; }
@Override public CharTermAttributeImpl clone() { CharTermAttributeImpl t = (CharTermAttributeImpl)super.clone(); // Do a deep clone t.termBuffer = new char[this.termLength]; System.arraycopy(this.termBuffer, 0, t.termBuffer, 0, this.termLength); t.builder = new BytesRefBuilder(); t.builder.copyBytes(builder.get()); return t; }
@Override public GeoPointTermAttributeImpl clone() { GeoPointTermAttributeImpl t = (GeoPointTermAttributeImpl)super.clone(); // Do a deep clone t.bytes = new BytesRefBuilder(); t.bytes.copyBytes(getBytesRef()); return t; }
@Override public NumericTermAttributeImpl clone() { NumericTermAttributeImpl t = (NumericTermAttributeImpl)super.clone(); // Do a deep clone t.bytes = new BytesRefBuilder(); t.bytes.copyBytes(getBytesRef()); return t; }
@Override public NumericTermAttributeImpl clone() { NumericTermAttributeImpl t = (NumericTermAttributeImpl)super.clone(); // Do a deep clone t.bytes = new BytesRefBuilder(); t.bytes.copyBytes(getBytesRef()); return t; }