Class LabelToOrdinal
java.lang.Object
org.apache.lucene.facet.taxonomy.writercache.LabelToOrdinal
- Direct Known Subclasses:
CompactLabelToOrdinal
Abstract class for storing Label->Ordinal mappings in a taxonomy.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intReturned bygetOrdinal(org.apache.lucene.facet.taxonomy.FacetLabel)when the label isn't recognized. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddLabel(FacetLabel label, int ordinal) Adds a new label if its not yet in the table.intreturn the maximal Ordinal assigned so farintReturns the next unassigned ordinal.abstract intgetOrdinal(FacetLabel label) Returns the ordinal assigned to the given label, orINVALID_ORDINALif the label cannot be found in this table.
-
Field Details
-
INVALID_ORDINAL
public static final int INVALID_ORDINALReturned bygetOrdinal(org.apache.lucene.facet.taxonomy.FacetLabel)when the label isn't recognized.- See Also:
-
-
Constructor Details
-
LabelToOrdinal
public LabelToOrdinal()Default constructor.
-
-
Method Details
-
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
Adds a new label if its not yet in the table. Throws anIllegalArgumentExceptionif the same label with a different ordinal was previoulsy added to this table. -
getOrdinal
Returns the ordinal assigned to the given label, orINVALID_ORDINALif the label cannot be found in this table.
-