Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.facet.taxonomy.writercache.cl2o
Class LabelToOrdinal

    java.lang.Object
      org.apache.lucene.facet.taxonomy.writercache.cl2o.LabelToOrdinal

Direct Known Subclasses:
  CompactLabelToOrdinal

    public abstract class LabelToOrdinal

extends Object

Abstract class for storing Label->Ordinal mappings in a taxonomy.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Field Summary
`protected int` | `counter`
`static int` | `InvalidOrdinal`

Constructor Summary
`LabelToOrdinal()`

Method Summary
`abstract void` | `addLabel(CategoryPath label, int ordinal)` Adds a new label if its not yet in the table.
`abstract void` | `addLabel(CategoryPath label, int prefixLen, int ordinal)` Adds a new label if its not yet in the table.
`int` | `getMaxOrdinal()` return the maximal Ordinal assigned so far
`int` | `getNextOrdinal()` Returns the next unassigned ordinal.
`abstract int` | `getOrdinal(CategoryPath label)`
`abstract int` | `getOrdinal(CategoryPath label, int prefixLen)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### counter

    protected int counter

### InvalidOrdinal

    public static final int InvalidOrdinal

See Also:
  Constant Field Values

Constructor Detail

### LabelToOrdinal

    public LabelToOrdinal()

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(CategoryPath label,
                                  int ordinal)

  Adds a new label if its not yet in the table. Throws an `IllegalArgumentException` if the same label with a different ordinal was previoulsy added to this table.

### addLabel

    public abstract void addLabel(CategoryPath label,
                                  int prefixLen,
                                  int ordinal)

  Adds a new label if its not yet in the table. Throws an `IllegalArgumentException` if the same label with a different ordinal was previoulsy added to this table.

### getOrdinal

    public abstract int getOrdinal(CategoryPath label)

  Returns:
    the ordinal assigned to the given label, or `InvalidOrdinal` if the label cannot be found in this table.

### getOrdinal

    public abstract int getOrdinal(CategoryPath label,
                                   int prefixLen)

  Returns:
    the ordinal assigned to the given label, or `InvalidOrdinal` if the label cannot be found in this table.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD