|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.sandia.cognition.util.AbstractCloneableSerializable
gov.sandia.cognition.text.term.AbstractTermIndex
gov.sandia.cognition.text.term.DefaultTermIndex
public class DefaultTermIndex
A default implementation of the TermIndex
interface.
Field Summary | |
---|---|
protected List<DefaultIndexedTerm> |
termList
The list of terms ordered by indices. |
protected Map<Term,DefaultIndexedTerm> |
termMap
The mapping of terms to their corresponding (unique) indices. |
Constructor Summary | |
---|---|
DefaultTermIndex()
Creates a new, empty DefaultTermIndex . |
Method Summary | |
---|---|
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 List<DefaultIndexedTerm> |
getTermList()
Sets the list of terms, ordered by index. |
protected Map<Term,DefaultIndexedTerm> |
getTermMap()
Gets the mapping of terms to their indices. |
List<DefaultIndexedTerm> |
getTerms()
Gets all of the terms in the index. |
protected void |
setTermList(List<DefaultIndexedTerm> termList)
Gets the list of terms, ordered by index. |
protected void |
setTermMap(Map<Term,DefaultIndexedTerm> termMap)
Sets the mapping of terms to their indices. |
Methods inherited from class gov.sandia.cognition.text.term.AbstractTermIndex |
---|
add, addAll, getIndex, getIndex, getIndexedTerm, getTerm, hasIndex, hasIndexedTerm, hasTerm, hasTerm |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map<Term,DefaultIndexedTerm> termMap
protected List<DefaultIndexedTerm> termList
Constructor Detail |
---|
public DefaultTermIndex()
DefaultTermIndex
.
Method Detail |
---|
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 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 Map<Term,DefaultIndexedTerm> getTermMap()
protected void setTermMap(Map<Term,DefaultIndexedTerm> termMap)
termMap
- The mapping of terms to their indices.protected List<DefaultIndexedTerm> getTermList()
protected void setTermList(List<DefaultIndexedTerm> termList)
termList
- The list of terms, ordered by index.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |