Class PackedTokenAttributeImpl
- java.lang.Object
- 
- org.apache.lucene.util.AttributeImpl
- 
- org.apache.lucene.analysis.tokenattributes.CharTermAttributeImpl
- 
- org.apache.lucene.analysis.tokenattributes.PackedTokenAttributeImpl
 
 
 
- 
- All Implemented Interfaces:
- Appendable,- CharSequence,- Cloneable,- CharTermAttribute,- OffsetAttribute,- PositionIncrementAttribute,- PositionLengthAttribute,- TermFrequencyAttribute,- TermToBytesRefAttribute,- TypeAttribute,- Attribute
 
 public class PackedTokenAttributeImpl extends CharTermAttributeImpl implements TypeAttribute, PositionIncrementAttribute, PositionLengthAttribute, OffsetAttribute, TermFrequencyAttribute Default implementation of the common attributes used by Lucene:
- 
- 
Field Summary- 
Fields inherited from class org.apache.lucene.analysis.tokenattributes.CharTermAttributeImplbuilder
 - 
Fields inherited from interface org.apache.lucene.analysis.tokenattributes.TypeAttributeDEFAULT_TYPE
 
- 
 - 
Constructor SummaryConstructors Constructor Description PackedTokenAttributeImpl()Constructs the attribute implementation.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Resets the attributesPackedTokenAttributeImplclone()In most cases the clone is, and should be, deep in order to be able to properly capture the state of all attributes.voidcopyTo(AttributeImpl target)Copies the values from this Attribute into the passed-in target attribute.voidend()Resets the attributes at endintendOffset()Returns this Token's ending offset, one greater than the position of the last character corresponding to this token in the source text.booleanequals(Object obj)intgetPositionIncrement()Returns the position increment of this Token.intgetPositionLength()Returns the position length of this Token.intgetTermFrequency()Returns the custom term frequency.inthashCode()voidreflectWith(AttributeReflector reflector)This method is for introspection of attributes, it should simply add the key/values this attribute holds to the givenAttributeReflector.voidsetOffset(int startOffset, int endOffset)Set the starting and ending offset.voidsetPositionIncrement(int positionIncrement)Set the position increment.voidsetPositionLength(int positionLength)Set the position length of this Token.voidsetTermFrequency(int termFrequency)Set the custom term frequency of the current term within one document.voidsetType(String type)Set the lexical type.intstartOffset()Returns this Token's starting offset, the position of the first character corresponding to this token in the source text.Stringtype()Returns this Token's lexical type.- 
Methods inherited from class org.apache.lucene.analysis.tokenattributes.CharTermAttributeImplappend, append, append, append, append, append, buffer, charAt, copyBuffer, getBytesRef, length, resizeBuffer, setEmpty, setLength, subSequence, toString
 - 
Methods inherited from class org.apache.lucene.util.AttributeImplreflectAsString
 - 
Methods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface java.lang.CharSequencechars, codePoints
 
- 
 
- 
- 
- 
Method Detail- 
setPositionIncrementpublic void setPositionIncrement(int positionIncrement) Set the position increment. The default value is one.- Specified by:
- setPositionIncrementin interface- PositionIncrementAttribute
- Parameters:
- positionIncrement- the distance from the prior term
- See Also:
- PositionIncrementAttribute
 
 - 
getPositionIncrementpublic int getPositionIncrement() Returns the position increment of this Token.- Specified by:
- getPositionIncrementin interface- PositionIncrementAttribute
- See Also:
- PositionIncrementAttribute
 
 - 
setPositionLengthpublic void setPositionLength(int positionLength) Set the position length of this Token.The default value is one. - Specified by:
- setPositionLengthin interface- PositionLengthAttribute
- Parameters:
- positionLength- how many positions this token spans.
- See Also:
- PositionLengthAttribute
 
 - 
getPositionLengthpublic int getPositionLength() Returns the position length of this Token.- Specified by:
- getPositionLengthin interface- PositionLengthAttribute
- See Also:
- PositionLengthAttribute
 
 - 
startOffsetpublic final int startOffset() Returns this Token's starting offset, the position of the first character corresponding to this token in the source text.Note that the difference between OffsetAttribute.endOffset()andstartOffset()may not be equal to termText.length(), as the term text may have been altered by a stemmer or some other filter.- Specified by:
- startOffsetin interface- OffsetAttribute
- See Also:
- OffsetAttribute
 
 - 
endOffsetpublic final int endOffset() Returns this Token's ending offset, one greater than the position of the last character corresponding to this token in the source text. The length of the token in the source text is (endOffset()-OffsetAttribute.startOffset()).- Specified by:
- endOffsetin interface- OffsetAttribute
- See Also:
- OffsetAttribute
 
 - 
setOffsetpublic void setOffset(int startOffset, int endOffset)Set the starting and ending offset.- Specified by:
- setOffsetin interface- OffsetAttribute
- See Also:
- OffsetAttribute
 
 - 
typepublic final String type() Returns this Token's lexical type. Defaults to "word".- Specified by:
- typein interface- TypeAttribute
- See Also:
- TypeAttribute
 
 - 
setTypepublic final void setType(String type) Set the lexical type.- Specified by:
- setTypein interface- TypeAttribute
- See Also:
- TypeAttribute
 
 - 
setTermFrequencypublic final void setTermFrequency(int termFrequency) Description copied from interface:TermFrequencyAttributeSet the custom term frequency of the current term within one document.- Specified by:
- setTermFrequencyin interface- TermFrequencyAttribute
 
 - 
getTermFrequencypublic final int getTermFrequency() Description copied from interface:TermFrequencyAttributeReturns the custom term frequency.- Specified by:
- getTermFrequencyin interface- TermFrequencyAttribute
 
 - 
clearpublic void clear() Resets the attributes- Overrides:
- clearin class- CharTermAttributeImpl
 
 - 
endpublic void end() Resets the attributes at end- Overrides:
- endin class- AttributeImpl
 
 - 
clonepublic PackedTokenAttributeImpl clone() Description copied from class:AttributeImplIn most cases the clone is, and should be, deep in order to be able to properly capture the state of all attributes.- Overrides:
- clonein class- CharTermAttributeImpl
 
 - 
equalspublic boolean equals(Object obj) - Overrides:
- equalsin class- CharTermAttributeImpl
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- CharTermAttributeImpl
 
 - 
copyTopublic void copyTo(AttributeImpl target) Description copied from class:AttributeImplCopies the values from this Attribute into the passed-in target attribute. The target implementation must support all the Attributes this implementation supports.- Overrides:
- copyToin class- CharTermAttributeImpl
 
 - 
reflectWithpublic void reflectWith(AttributeReflector reflector) Description copied from class:AttributeImplThis method is for introspection of attributes, it should simply add the key/values this attribute holds to the givenAttributeReflector.Implementations look like this (e.g. for a combined attribute implementation): public void reflectWith(AttributeReflector reflector) { reflector.reflect(CharTermAttribute.class, "term", term()); reflector.reflect(PositionIncrementAttribute.class, "positionIncrement", getPositionIncrement()); }If you implement this method, make sure that for each invocation, the same set of Attributeinterfaces and keys are passed toAttributeReflector.reflect(java.lang.Class<? extends org.apache.lucene.util.Attribute>, java.lang.String, java.lang.Object)in the same order, but possibly different values. So don't automatically exclude e.g.nullproperties!- Overrides:
- reflectWithin class- CharTermAttributeImpl
- See Also:
- AttributeImpl.reflectAsString(boolean)
 
 
- 
 
-