public class DefaultTermIndex extends AbstractTermIndex
TermIndex
interface.Modifier and Type | Field and Description |
---|---|
protected java.util.List<DefaultIndexedTerm> |
termList
The list of terms ordered by indices.
|
protected java.util.Map<Term,DefaultIndexedTerm> |
termMap
The mapping of terms to their corresponding (unique) indices.
|
Constructor and Description |
---|
DefaultTermIndex()
Creates a new, empty
DefaultTermIndex . |
Modifier and Type | Method and Description |
---|---|
IndexedTerm |
add(Term term)
Adds the given term to the index.
|
DefaultTermIndex |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
DefaultIndexedTerm |
getIndexedTerm(int index)
Gets the index-term pair for the given index.
|
DefaultIndexedTerm |
getIndexedTerm(Term term)
Gets the index-term pair for the given term, if it is in the index.
|
int |
getTermCount()
Gets the number of terms.
|
protected java.util.List<DefaultIndexedTerm> |
getTermList()
Sets the list of terms, ordered by index.
|
protected java.util.Map<Term,DefaultIndexedTerm> |
getTermMap()
Gets the mapping of terms to their indices.
|
java.util.List<DefaultIndexedTerm> |
getTerms()
Gets all of the terms in the index.
|
protected void |
setTermList(java.util.List<DefaultIndexedTerm> termList)
Gets the list of terms, ordered by index.
|
protected void |
setTermMap(java.util.Map<Term,DefaultIndexedTerm> termMap)
Sets the mapping of terms to their indices.
|
add, addAll, getIndex, getIndex, getIndexedTerm, getTerm, hasIndex, hasIndexedTerm, hasTerm, hasTerm
protected java.util.Map<Term,DefaultIndexedTerm> termMap
protected java.util.List<DefaultIndexedTerm> termList
public DefaultTermIndex()
DefaultTermIndex
.public DefaultTermIndex clone()
AbstractCloneableSerializable
Object
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 CloneableSerializable
clone
in class AbstractCloneableSerializable
public IndexedTerm add(Term term)
TermIndex
term
- The term to add.public int getTermCount()
TermIndex
public java.util.List<DefaultIndexedTerm> getTerms()
TermIndex
public DefaultIndexedTerm getIndexedTerm(Term term)
TermIndex
term
- The term to get the index-term pair for.public DefaultIndexedTerm getIndexedTerm(int index)
TermIndex
index
- The index to get the index-term pair for.protected java.util.Map<Term,DefaultIndexedTerm> getTermMap()
protected void setTermMap(java.util.Map<Term,DefaultIndexedTerm> termMap)
termMap
- The mapping of terms to their indices.protected java.util.List<DefaultIndexedTerm> getTermList()
protected void setTermList(java.util.List<DefaultIndexedTerm> termList)
termList
- The list of terms, ordered by index.