Class LabelDictionary


  • public class LabelDictionary
    extends Object
    This provides a way of using small int values to represent String labels, as opposed to storing the labels directly.
    Author:
    Denilson Barbosa, Nikolaus Augsten from approxlib, available at http://www.inf.unibz.it/~augsten/src/
    • Constructor Detail

      • LabelDictionary

        public LabelDictionary()
        Creates a new blank dictionary.
    • Method Detail

      • store

        public int store​(String label)
        Adds a new label to the dictionary if it has not been added yet. Returns the ID of the new label in the dictionary.
        Parameters:
        label - add this label to the dictionary if it does not exist yet
        Returns:
        ID of label in the dictionary
      • read

        public String read​(int labelID)
        Returns the label with a given ID in the dictionary.
        Parameters:
        labelID -
        Returns:
        the label with the specified labelID, or null if this dictionary contains no label for labelID
      • isNewLabelsAllowed

        public boolean isNewLabelsAllowed()
        Returns:
        true iff new labels can be stored into this label dictionary
      • setNewLabelsAllowed

        public void setNewLabelsAllowed​(boolean newLabelsAllowed)
        Parameters:
        newLabelsAllowed - the newLabelsAllowed to set