Class LabelDictionary
- java.lang.Object
-
- com.crawljax.stateabstractions.dom.RTED.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 Summary
Constructors Constructor Description LabelDictionary()Creates a new blank dictionary.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisNewLabelsAllowed()Stringread(int labelID)Returns the label with a given ID in the dictionary.voidsetNewLabelsAllowed(boolean newLabelsAllowed)intstore(String label)Adds a new label to the dictionary if it has not been added yet.
-
-
-
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
-
-