Class LabelToOrdinal
- java.lang.Object
-
- org.apache.lucene.facet.taxonomy.writercache.LabelToOrdinal
-
- Direct Known Subclasses:
CompactLabelToOrdinal
public abstract class LabelToOrdinal extends java.lang.Object
Abstract class for storing Label->Ordinal mappings in a taxonomy.
-
-
Field Summary
Fields Modifier and Type Field Description static int
INVALID_ORDINAL
Returned bygetOrdinal(org.apache.lucene.facet.taxonomy.FacetLabel)
when the label isn't recognized.
-
Constructor Summary
Constructors Constructor Description LabelToOrdinal()
Default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addLabel(FacetLabel label, int ordinal)
Adds a new label if its not yet in the table.int
getMaxOrdinal()
return the maximal Ordinal assigned so farint
getNextOrdinal()
Returns the next unassigned ordinal.abstract int
getOrdinal(FacetLabel label)
Returns the ordinal assigned to the given label, orINVALID_ORDINAL
if the label cannot be found in this table.
-
-
-
Field Detail
-
INVALID_ORDINAL
public static final int INVALID_ORDINAL
Returned bygetOrdinal(org.apache.lucene.facet.taxonomy.FacetLabel)
when the label isn't recognized.- See Also:
- Constant Field Values
-
-
Method Detail
-
getMaxOrdinal
public int getMaxOrdinal()
return the maximal Ordinal assigned so far
-
getNextOrdinal
public int getNextOrdinal()
Returns the next unassigned ordinal. The default behavior of this method is to simply increment a counter.
-
addLabel
public abstract void addLabel(FacetLabel label, int ordinal)
Adds a new label if its not yet in the table. Throws anIllegalArgumentException
if the same label with a different ordinal was previoulsy added to this table.
-
getOrdinal
public abstract int getOrdinal(FacetLabel label)
Returns the ordinal assigned to the given label, orINVALID_ORDINAL
if the label cannot be found in this table.
-
-