it.unimi.dsi.mg4j.index
Class TermMaps.SynchronizedTermMap

java.lang.Object
  extended by it.unimi.dsi.mg4j.index.TermMaps.SynchronizedTermMap
All Implemented Interfaces:
TermMap, Serializable
Direct Known Subclasses:
TermMaps.SynchronizedTermPrefixMap
Enclosing class:
TermMaps

protected static class TermMaps.SynchronizedTermMap
extends Object
implements TermMap, Serializable

See Also:
Serialized Form

Field Summary
protected  TermMap termMap
           
 
Constructor Summary
TermMaps.SynchronizedTermMap(TermMap termMap)
           
 
Method Summary
 int getNumber(CharSequence term)
          Returns the ordinal number corresponding to the given term, or possibly (but not necessarily) -1 if the term was not indexed.
 CharSequence getTerm(int index)
          Returns the term corresponding to the given ordinal number (optional operation).
 MutableString getTerm(int index, MutableString term)
          Writes in the given mutable string the term corresponding to the given ordinal number (optional operation).
 boolean hasTerms()
          Returns true if this prefix map supports term retrieval.
 int size()
          Returns the number of terms in this term map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

termMap

protected final TermMap termMap
Constructor Detail

TermMaps.SynchronizedTermMap

public TermMaps.SynchronizedTermMap(TermMap termMap)
Method Detail

size

public int size()
Description copied from interface: TermMap
Returns the number of terms in this term map.

Specified by:
size in interface TermMap
Returns:
the number of terms in this term map.

getNumber

public int getNumber(CharSequence term)
Description copied from interface: TermMap
Returns the ordinal number corresponding to the given term, or possibly (but not necessarily) -1 if the term was not indexed.

We intentionally prefer “ordinal number” to “index” because of the obvious confusion that the latter term can cause.

Specified by:
getNumber in interface TermMap
Parameters:
term - a term.
Returns:
its ordinal number, or possibly (but not necessarily) -1 if the term was not indexed.

getTerm

public MutableString getTerm(int index,
                             MutableString term)
Description copied from interface: TermMap
Writes in the given mutable string the term corresponding to the given ordinal number (optional operation).

Specified by:
getTerm in interface TermMap
Parameters:
index - a term ordinal number.
term - a mutable string that will be filled with the corresponding term.
Returns:
term, or possibly (but not necessarily) null if the term was not indexed.

getTerm

public CharSequence getTerm(int index)
Description copied from interface: TermMap
Returns the term corresponding to the given ordinal number (optional operation).

Specified by:
getTerm in interface TermMap
Parameters:
index - a term ordinal number.
Returns:
the corresponding term, or possibly (but not necessarily) null if the term was not indexed.

hasTerms

public boolean hasTerms()
Description copied from interface: TermMap
Returns true if this prefix map supports term retrieval.

Specified by:
hasTerms in interface TermMap
Returns:
true if this prefix map supports term retrieval.