Class AbstractLabeledIntMap
java.lang.Object
it.univr.di.labeledvalue.AbstractLabeledIntMap
- All Implemented Interfaces:
LabeledIntMap, Serializable
- Direct Known Subclasses:
LabeledIntHierarchyMap, LabeledIntSimpleMap, LabeledIntTreeMap
Abstract class for
LabeledIntMap interface.- Version:
- $Rev: 1153 $
- Author:
- Roberto Posenato
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface LabeledIntMap
LabeledIntMap.LabeledIntMapViewModifier and TypeInterfaceDescriptionstatic interfaceA read-only view of an object -
Field Summary
FieldsModifier and TypeFieldDescription(package private) intThe number of elements in the map(package private) static final StringA labeled value as a regular expression.(package private) static final PatternMatcher for a set of labeled values.(package private) booleanOptimize.(package private) static final longSerial number(package private) static final PatternPattern for splitting a set of labeled values.(package private) static final Pattern(package private) static final StringAdmissible values as a regular expression.(package private) static final PatternPattern of valueREStringFields inherited from interface LabeledIntMap
entryComparatorModifier and TypeFieldDescriptionstatic final Comparator<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Label>> A natural comparator for Entry<Label>. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static StringentryAsString(it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Label> entry) static StringentryAsString(Label label, int value) final booleanfinal inthashCode()booleanisEmpty()static LabeledIntMapstatic LabeledIntMapparse(String inputMap, Class<? extends LabeledIntMap> labeledIntMapClass) Parse a string representing a LabeledValueTreeMap and return an object containing the labeled values represented by the string.intsize()final StringtoString()Methods inherited from interface LabeledIntMap
alreadyRepresents, clear, entrySet, get, getMaxValue, getMaxValueSubsumedBy, getMinLabeledValue, getMinValue, getMinValueAmongLabelsWOUnknown, getMinValueConsistentWith, getMinValueSubsumedBy, keySet, newInstance, newInstance, newInstance, newInstance, put, putAll, putForcibly, remove, unmodifiable, valuesModifier and TypeMethodDescriptionbooleanalreadyRepresents(Label newLabel, int newValue) voidclear()Remove all entries from the map.it.unimi.dsi.fastutil.objects.ObjectSet<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Label>> entrySet()The set of all map entries.intdefault intdefault intReturns the value associated with thelif it exists, otherwise the maximal value among all labels consistent withl.default it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Label> default intdefault intdefault intReturns the value associated with thelif it exists, otherwise the minimal value among all labels consistent withl.default intReturns the minimal value among those associated with labels subsumed bylif it exists,Constants.INT_NULLotherwise.it.unimi.dsi.fastutil.objects.ObjectSet<Label> keySet()A copy of all labels in the map.FactorynewInstance(boolean optimize) FactorynewInstance(LabeledIntMap lim) FactorynewInstance(LabeledIntMap lim, boolean optimize) FactorybooleanPut a label with valueiif labellis not null and there is no labeled value in the set with labell, or it is present but with a value higher thanl.default voidputAll(LabeledIntMap inputMap) Put all elements of `inputMap` into the current one without making a defensive copy.voidputForcibly(Label l, int i) Put the labeled value without any control.intRemove the labellfrom the map.it.unimi.dsi.fastutil.ints.IntSetvalues()
-
Field Details
-
valueRE
Admissible values as a regular expression. For now, only integers!- See Also:
-
valueREPattern
Pattern of valueREString -
labeledValueRE
A labeled value as a regular expression. -
labeledValueSetREPattern
Matcher for a set of labeled values. WARNING: After some tests, I verified that this pattern cannot be used because it is too time-consuming.
I maintain it as a check in some tests. -
serialVersionUID
static final long serialVersionUIDSerial number- See Also:
-
splitterEntryPattern
Pattern for splitting a set of labeled values. -
splitterPair
-
count
int countThe number of elements in the map -
optimize
boolean optimizeOptimize. In some applications, it is important to maintain '¬C,0', and 'C,1'. The optimization would reduce them to '⊡,0' and 'C,1'. So, set false optimized to maintain '¬C,0', and 'C,1'. The default is true.
-
-
Constructor Details
-
AbstractLabeledIntMap
public AbstractLabeledIntMap()
-
-
Method Details
-
entryAsString
-
entryAsString
-
parse
- Parameters:
inputMap- the string representing a set of labeled values- Returns:
- a new labeled int map object
- See Also:
-
parse
@Nullable public static LabeledIntMap parse(String inputMap, Class<? extends LabeledIntMap> labeledIntMapClass) Parse a string representing a LabeledValueTreeMap and return an object containing the labeled values represented by the string.The format of the string is given by the method
toString(): {\[(<value>, <key>) \]*}.This method is also capable of parsing the old format: {\[(<key>, <value>) \]*}
- Parameters:
inputMap- aStringobject.labeledIntMapClass- the class to manage the labeled values- Returns:
- a LabeledValueTreeMap object if
inputMaprepresents a valid map, null otherwise.
-
equals
-
hashCode
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceLabeledIntMap- Returns:
- true if the map has no elements.
-
size
public int size()- Specified by:
sizein interfaceLabeledIntMap- Returns:
- the number of labeled values (value with empty label included).
- See Also:
-
toString
-