|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.lucene.util.AttributeImpl
org.apache.lucene.analysis.NumericTokenStream.NumericTermAttributeImpl
public static final class NumericTokenStream.NumericTermAttributeImpl
Implementation of NumericTokenStream.NumericTermAttribute.
| Constructor Summary | |
|---|---|
NumericTokenStream.NumericTermAttributeImpl()
Creates, but does not yet initialize this attribute instance |
|
| Method Summary | |
|---|---|
void |
clear()
Clears the values in this AttributeImpl and resets it to its default value. |
void |
copyTo(AttributeImpl target)
Copies the values from this Attribute into the passed-in target attribute. |
int |
fillBytesRef()
Updates the bytes TermToBytesRefAttribute.getBytesRef() to contain this term's
final encoding, and returns its hashcode. |
BytesRef |
getBytesRef()
Retrieve this attribute's BytesRef. |
long |
getRawValue()
Returns current token's raw value as long with all NumericTokenStream.NumericTermAttribute.getShift() applied, undefined before first token |
int |
getShift()
Returns current shift value, undefined before first token |
int |
getValueSize()
Returns value size in bits (32 for float, int; 64 for double, long) |
int |
incShift()
Don't call this method! |
void |
init(long value,
int valueSize,
int precisionStep,
int shift)
Don't call this method! |
void |
reflectWith(AttributeReflector reflector)
This method is for introspection of attributes, it should simply add the key/values this attribute holds to the given AttributeReflector. |
void |
setShift(int shift)
Don't call this method! |
| Methods inherited from class org.apache.lucene.util.AttributeImpl |
|---|
clone, reflectAsString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NumericTokenStream.NumericTermAttributeImpl()
init(long, int, int, int)| Method Detail |
|---|
public BytesRef getBytesRef()
TermToBytesRefAttributeTermToBytesRefAttribute.fillBytesRef().
getBytesRef in interface TermToBytesRefAttributepublic int fillBytesRef()
TermToBytesRefAttributeTermToBytesRefAttribute.getBytesRef() to contain this term's
final encoding, and returns its hashcode.
fillBytesRef in interface TermToBytesRefAttributeBytesRef.hashCode():
int hash = 0;
for (int i = termBytes.offset; i < termBytes.offset+termBytes.length; i++) {
hash = 31*hash + termBytes.bytes[i];
}
Implement this for performance reasons, if your code can calculate
the hash on-the-fly. If this is not the case, just return
termBytes.hashCode().public int getShift()
NumericTokenStream.NumericTermAttribute
getShift in interface NumericTokenStream.NumericTermAttributepublic void setShift(int shift)
NumericTokenStream.NumericTermAttribute
setShift in interface NumericTokenStream.NumericTermAttributepublic int incShift()
NumericTokenStream.NumericTermAttribute
incShift in interface NumericTokenStream.NumericTermAttributepublic long getRawValue()
NumericTokenStream.NumericTermAttributelong with all NumericTokenStream.NumericTermAttribute.getShift() applied, undefined before first token
getRawValue in interface NumericTokenStream.NumericTermAttributepublic int getValueSize()
NumericTokenStream.NumericTermAttributefloat, int; 64 for double, long)
getValueSize in interface NumericTokenStream.NumericTermAttribute
public void init(long value,
int valueSize,
int precisionStep,
int shift)
NumericTokenStream.NumericTermAttribute
init in interface NumericTokenStream.NumericTermAttributepublic void clear()
AttributeImpl
clear in class AttributeImplpublic void reflectWith(AttributeReflector reflector)
AttributeImplAttributeReflector.
The default implementation calls AttributeReflector.reflect(java.lang.Class extends org.apache.lucene.util.Attribute>, java.lang.String, java.lang.Object) for all
non-static fields from the implementing class, using the field name as key
and the field value as value. The Attribute class is also determined by reflection.
Please note that the default implementation can only handle single-Attribute
implementations.
Custom 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 Attribute
interfaces and keys are passed to AttributeReflector.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. null properties!
reflectWith in class AttributeImplAttributeImpl.reflectAsString(boolean)public void copyTo(AttributeImpl target)
AttributeImpl
copyTo in class AttributeImpl
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||