public class DefaultIndexedTerm extends AbstractCloneableSerializable implements IndexedTerm
IndexedTerm interface. It just stores
the index and the term.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_INDEX
The default index is -1.
|
protected int |
index
The index of the term.
|
protected Term |
term
The term.
|
| Constructor and Description |
|---|
DefaultIndexedTerm()
Creates a new
DefaultIndexedTerm with default values. |
DefaultIndexedTerm(int index,
Term term)
Creates a new
DefaultIndexedTerm with the given index and term. |
| Modifier and Type | Method and Description |
|---|---|
Term |
asTerm()
Get the term for the object.
|
DefaultIndexedTerm |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
boolean |
equals(DefaultIndexedTerm other)
Determines if this object is equal to the given object.
|
boolean |
equals(java.lang.Object other) |
int |
getIndex()
Gets the index associated with the term.
|
Term |
getTerm()
Gets the term associated with the index.
|
int |
hashCode() |
protected void |
setIndex(int index)
Sets the index of the term.
|
protected void |
setTerm(Term term)
Sets the term.
|
java.lang.String |
toString() |
public static final int DEFAULT_INDEX
protected int index
protected Term term
public DefaultIndexedTerm()
DefaultIndexedTerm with default values.public DefaultIndexedTerm(int index,
Term term)
DefaultIndexedTerm with the given index and term.index - The index of the term.term - The term.public DefaultIndexedTerm clone()
AbstractCloneableSerializableObject class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone() to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone() as the basis for your implementation.clone in interface CloneableSerializableclone in class AbstractCloneableSerializablepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic boolean equals(DefaultIndexedTerm other)
other - Another object.public Term asTerm()
Termablepublic int getIndex()
IndexedTermgetIndex in interface IndexedTermprotected void setIndex(int index)
index - The index of the term.public Term getTerm()
IndexedTermgetTerm in interface IndexedTermprotected void setTerm(Term term)
term - The term.public java.lang.String toString()
toString in class java.lang.Object