Interface LabeledIntMap
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
LabeledIntMap.LabeledIntMapView
- All Known Implementing Classes:
AbstractLabeledIntMap,LabeledIntHierarchyMap,LabeledIntHierarchyMap.LabeledIntHierarchyMapView,LabeledIntSimpleMap,LabeledIntSimpleMap.LabeledIntNotMinMapView,LabeledIntTreeMap,LabeledIntTreeMap.LabeledIntTreeMapView,LabeledIntTreeSimpleMap
Label-->int
The semantics of a set of labeled values is defined in the paper “The Dynamic Controllability of Conditional STNs with Uncertainty” by Hunsberger, Luke, Roberto Posenato, and Carlo Combi. 2012. https://arxiv.org/abs/1212.2005.
All methods managing a single labeled value have to make a defensive copy of the label to guarantee that the label insert/get is a copy of the label given/requested.
All methods managing a bundle of labeled values do not have to make a defensive copy for performance reasons.
- Version:
- $Rev: 993 $
- Author:
- Robert Posenato
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA read-only view of an object -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Label>> A natural comparator for Entry<Label>.static final longSerial UID -
Method Summary
Modifier 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.booleanisEmpty()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.intsize()it.unimi.dsi.fastutil.ints.IntSetvalues()
-
Field Details
-
entryComparator
A natural comparator for Entry<Label>. It orders the elements considering the alphabetical order of labels. -
serialVersionUID
static final long serialVersionUIDSerial UID- See Also:
-
-
Method Details
-
alreadyRepresents
- Parameters:
newLabel- aLabelobject.newValue- the new value.- Returns:
- true if the current map can represent the value. In a positive case, the addition of the element does not change the map. If it returns false, then adding the value to the map would modify the map.
-
clear
void clear()Remove all entries from the map.- See Also:
-
entrySet
it.unimi.dsi.fastutil.objects.ObjectSet<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Label>> entrySet()The set of all map entries. The set is a view of the map. A modification of the map is reflected in the entries of the returned set.
If it is necessary to scan all the entries to modify the map, the only right way is to consider the keys returned bykeySet()and use methods likeremove(Label)and/orput(Label, int).- Returns:
- The set of all map entries.
- See Also:
-
get
- Parameters:
l- anLabelobject.- Returns:
- the value associated to
lif it exists,Constants.INT_NULLotherwise.
-
getMaxValue
default int getMaxValue()- Returns:
- the maximum int value present in the set if the set is not empty;
Constants.INT_NULLotherwise.
-
getMaxValueSubsumedBy
Returns the value associated with thelif it exists, otherwise the maximal value among all labels consistent withl.- Parameters:
l- If it is null,Constants.INT_NULLis returned.- Returns:
- the value associated with the
lif it exists or the maximal value among values associated with labels consistent withl. If no labels are consistent byl,Constants.INT_NULLis returned.
-
getMinLabeledValue
- Returns:
- the minimum entry in the set if the set is not empty; an entry with
Constants.INT_NULLotherwise.
-
getMinValue
default int getMinValue()- Returns:
- the minimum int value present in the set if the set is not empty;
Constants.INT_NULLotherwise.
-
getMinValueAmongLabelsWOUnknown
default int getMinValueAmongLabelsWOUnknown()- Returns:
- the minimum value among all labeled values having a label without unknown literals.
-
getMinValueConsistentWith
Returns the value associated with thelif it exists, otherwise the minimal value among all labels consistent withl.- Parameters:
l- If it is null,Constants.INT_NULLis returned.- Returns:
- the value associated with the
lif it exists or the minimal value among values associated with labels consistent withl. If no labels are consistent byl,Constants.INT_NULLis returned.
-
getMinValueSubsumedBy
Returns the minimal value among those associated with labels subsumed bylif it exists,Constants.INT_NULLotherwise.- Parameters:
l- If it is null,Constants.INT_NULLis returned.- Returns:
- minimal value among those associated with labels subsumed by
lif it exists,Constants.INT_NULLotherwise.
-
isEmpty
boolean isEmpty()- Returns:
- true if the map has no elements.
-
keySet
it.unimi.dsi.fastutil.objects.ObjectSet<Label> keySet()A copy of all labels in the map.The returned set must not be connected to the map.
The semantics of this method is different from the
Map.keySet()!It can cost time and memory because it duplicates all the keys of the map.
This method allows one to scan all the keys of the map, even if during the scan, some key of the map is removed.
It is important to modify this map using only the method
remove(Label).Method
entrySet()returns a view of the entries of the map. Therefore, it cannot be used to scan or modify the map.- Returns:
- a copy of all labels in the map.
-
newInstance
LabeledIntMap newInstance()Factory- Returns:
- an object of type LabeledIntMap.
-
newInstance
Factory- Parameters:
optimize- true for having the label as short as possible, false otherwise. For example, the set {(0, ¬C), (1, C)} is represented as {(0, ⊡), (1, C)} if this parameter is true.- Returns:
- an object of type LabeledIntMap.
-
newInstance
Factory- Parameters:
lim- a map to clone.- Returns:
- an object of type LabeledIntMap.
-
newInstance
Factory- Parameters:
lim- a map to clone.optimize- true for having the label as short as possible, false otherwise.
For example, the set {(0, ¬C), (1, C)} is represented as {(0, ⊡), (1, C)} if this parameter is true.- Returns:
- an object of type LabeledIntMap.
-
put
Put 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.Not mandatory: the method can remove or modify other labeled values of the set to minimize the labeled values present, guaranteeing that no info is lost.
- Parameters:
l- a non-null label.i- a notConstants.INT_NULLvalue.- Returns:
- true if
(l,i)has been inserted. Since an insertion can remove more than one redundant labeled value, it is nonsensical to return "the old value" as expected from a classical put method.
-
putAll
Put all elements of `inputMap` into the current one without making a defensive copy.- Parameters:
inputMap- an object.- See Also:
-
putForcibly
Put the labeled value without any control. It is dangerous, but it can help in some cases.- Parameters:
l- aLabelobject.i- the new value.
-
remove
Remove the labellfrom the map. If thelis not present, it does nothing.- Parameters:
l- a non-null label.- Returns:
- the previous value associated with
l, orConstants.INT_NULLif there was no mapping forl.
-
size
int size()- Returns:
- the number of labeled values (value with empty label included).
- See Also:
-
unmodifiable
LabeledIntMap.LabeledIntMapView unmodifiable()- Returns:
- a read-only view of this.
-
values
it.unimi.dsi.fastutil.ints.IntSet values()- Returns:
- the set of all integer values present in the map as an ordered list.
-