gov.sandia.cognition.text.term
Interface TermIndex

All Known Implementing Classes:
AbstractTermIndex, DefaultTermIndex

public interface TermIndex

An interface for an index of terms. It assigns each term a unique non-negative integer index.

Since:
3.0
Author:
Justin Basilico

Method Summary
 IndexedTerm add(Term term)
          Adds the given term to the index.
 IndexedTerm add(Termable termable)
          Adds the given term to the index.
 void addAll(Iterable<? extends Termable> terms)
          Adds all of the given terms to the index, if they are not already part of it.
 int getIndex(Term term)
          Gets the index of the given term.
 int getIndex(Termable term)
          Gets the index of the given term.
 IndexedTerm getIndexedTerm(int index)
          Gets the index-term pair for the given index.
 IndexedTerm getIndexedTerm(Term term)
          Gets the index-term pair for the given term, if it is in the index.
 IndexedTerm getIndexedTerm(Termable term)
          Gets the index-term pair for the given term, if it is in the index.
 Term getTerm(int index)
          Gets the term associated with the given index.
 int getTermCount()
          Gets the number of terms.
 List<? extends IndexedTerm> getTerms()
          Gets all of the terms in the index.
 boolean hasIndex(int index)
          Determines if the term index contains the given index.
 boolean hasIndexedTerm(IndexedTerm indexedTerm)
          Determines if the given indexed term matches the term at the given index value in this term index.
 boolean hasTerm(Term term)
          Determines if the index contains the given term.
 boolean hasTerm(Termable term)
          Determines if the index contains the given term.
 

Method Detail

getTermCount

int getTermCount()
Gets the number of terms.

Returns:
The total number of terms.

getTerms

List<? extends IndexedTerm> getTerms()
Gets all of the terms in the index.

Returns:
A list of all the terms in the index.

getIndexedTerm

IndexedTerm getIndexedTerm(Termable term)
Gets the index-term pair for the given term, if it is in the index. Otherwise, null is returned.

Parameters:
term - The term to get the index-term pair for.
Returns:
The index-term pair for the given term, if it is in the index. Otherwise, null.

getIndexedTerm

IndexedTerm getIndexedTerm(Term term)
Gets the index-term pair for the given term, if it is in the index. Otherwise, null is returned.

Parameters:
term - The term to get the index-term pair for.
Returns:
The index-term pair for the given term, if it is in the index. Otherwise, null.

getIndexedTerm

IndexedTerm getIndexedTerm(int index)
Gets the index-term pair for the given index.

Parameters:
index - The index to get the index-term pair for.
Returns:
The index-term pair for the given index.

hasIndexedTerm

boolean hasIndexedTerm(IndexedTerm indexedTerm)
Determines if the given indexed term matches the term at the given index value in this term index.

Parameters:
indexedTerm - An index-term pair.
Returns:
True if the given index-term pair is an exact match for the term at the given index in this index. Otherwise, false.

hasTerm

boolean hasTerm(Termable term)
Determines if the index contains the given term.

Parameters:
term - The term.
Returns:
True if the term is in the index and false otherwise.

hasTerm

boolean hasTerm(Term term)
Determines if the index contains the given term.

Parameters:
term - The term.
Returns:
True if the term is in the index and false otherwise.

hasIndex

boolean hasIndex(int index)
Determines if the term index contains the given index.

Parameters:
index - An index.
Returns:
True if if is a valid index. Otherwise, false.

getIndex

int getIndex(Termable term)
Gets the index of the given term. If it is not in the index, -1 is returned.

Parameters:
term - The term to get the index of.
Returns:
The index of the term, if is is in the index; otherwise, -1.

getIndex

int getIndex(Term term)
Gets the index of the given term. If it is not in the index, -1 is returned.

Parameters:
term - The term to get the index of.
Returns:
The index of the term, if is is in the index; otherwise, -1.

getTerm

Term getTerm(int index)
Gets the term associated with the given index. If there is no term, null is returned.

Parameters:
index - The index to get the term for.
Returns:
The term at the given index, if there is a term; otherwise, null.

add

IndexedTerm add(Termable termable)
Adds the given term to the index. The returned value will be the index of that term and if it is not in the index already, it will be added.

Parameters:
termable - The term to add.
Returns:
The index of the term.

add

IndexedTerm add(Term term)
Adds the given term to the index. The returned value will be the index of that term and if it is not in the index already, it will be added.

Parameters:
term - The term to add.
Returns:
The index of the term.

addAll

void addAll(Iterable<? extends Termable> terms)
Adds all of the given terms to the index, if they are not already part of it.

Parameters:
terms - The terms to add to the index.