Package it.univr.di.labeledvalue
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
Realizes the map
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 in order to guarantee that the
label insert/get is a copy of the label given/requested.
All methods managing bundle of labeled values do not
have to make a defensive copy for performance reasons.
- Version:
- $Rev: 851 $
- Author:
- Robert Posenato
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
A 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>. -
Method Summary
Modifier and TypeMethodDescriptionboolean
alreadyRepresents
(Label newLabel, int newValue) void
clear()
Remove all entries of the map.it.unimi.dsi.fastutil.objects.ObjectSet
<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Label>> entrySet()
The set of all entries of the map.it.unimi.dsi.fastutil.objects.ObjectSet
<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Label>> entrySet
(it.unimi.dsi.fastutil.objects.ObjectSet<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Label>> setToReuse) The set of all entries of the map.int
default int
default int
Returns the value associated to thel
if it exists, otherwise the maximal value among all labels consistent withl
.default it.unimi.dsi.fastutil.objects.Object2IntMap.Entry
<Label> default int
default int
default int
Returns the value associated to thel
if it exists, otherwise the minimal value among all labels consistent withl
.default int
Returns the minimal value among those associated to labels subsumed byl
if it exists,Constants.INT_NULL
otherwise.boolean
isEmpty()
it.unimi.dsi.fastutil.objects.ObjectSet
<Label> keySet()
A copy of all labels in the map.it.unimi.dsi.fastutil.objects.ObjectSet
<Label> FactorynewInstance
(boolean optimize) FactorynewInstance
(LabeledIntMap lim) FactorynewInstance
(LabeledIntMap lim, boolean optimize) Factoryboolean
Put a label with valuei
if labell
is not null and there is not a labeled value in the set with labell
or it is present but with a value higher thanl
.default void
putAll
(LabeledIntMap inputMap) Put all elements of inputMap into the current one without making a defensive copy.void
putForcibly
(Label l, int i) Put the labeled value without any control.int
Remove the labell
from the map.int
size()
it.unimi.dsi.fastutil.ints.IntSet
values()
-
Field Details
-
entryComparator
A natural comparator for Entry<Label>. It orders considering the alphabetical order of Label.
-
-
Method Details
-
alreadyRepresents
- Parameters:
newLabel
- aLabel
object.newValue
- the new value.- Returns:
- true if the current map can represent the value. In positive case, an add of the element does not change the map. If returns false, then the adding of the value to the map would modify the map.
-
clear
void clear()Remove all entries of the map.- See Also:
-
entrySet
it.unimi.dsi.fastutil.objects.ObjectSet<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Label>> entrySet(@Nonnull it.unimi.dsi.fastutil.objects.ObjectSet<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Label>> setToReuse) The set of all entries of the map. The set can be a view of the map, so any modification of the map can be reflected on the returned entrySet().
In other word, don't modify the map during the use of this returned set.- Parameters:
setToReuse
- aObjectSet
object.- Returns:
- The set of all entries of the map.
- See Also:
-
entrySet
it.unimi.dsi.fastutil.objects.ObjectSet<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Label>> entrySet()The set of all entries of the map. The set can be a view of the map, so any modification of the map can be reflected on the returned entrySet.
In other word, don't modify the map during the use of this returned set.- Returns:
- The set of all entries of the map.
- See Also:
-
get
- Parameters:
l
- anLabel
object.- Returns:
- the value associated to
l
if it exists,Constants.INT_NULL
otherwise.
-
getMaxValue
default int getMaxValue()- Returns:
- the maximum int value present in the set if the set is not empty;
Constants.INT_NULL
otherwise.
-
getMaxValueSubsumedBy
Returns the value associated to thel
if it exists, otherwise the maximal value among all labels consistent withl
.- Parameters:
l
- If it is null,Constants.INT_NULL
is returned.- Returns:
- the value associated to the
l
if it exists or the maximal value among values associated to labels consistent withl
. If no labels are consistent byl
,Constants.INT_NULL
is returned.
-
getMinLabeledValue
- Returns:
- the minimum entry in the set if the set is not empty; an entry with
Constants.INT_NULL
otherwise.
-
getMinValue
default int getMinValue()- Returns:
- the minimum int value present in the set if the set is not empty;
Constants.INT_NULL
otherwise.
-
getMinValueAmongLabelsWOUnknown
default int getMinValueAmongLabelsWOUnknown()- Returns:
- the min value among all labeled value having label without unknown literals.
-
getMinValueConsistentWith
Returns the value associated to thel
if it exists, otherwise the minimal value among all labels consistent withl
.- Parameters:
l
- If it is null,Constants.INT_NULL
is returned.- Returns:
- the value associated to the
l
if it exists or the minimal value among values associated to labels consistent withl
. If no labels are consistent byl
,Constants.INT_NULL
is returned.
-
getMinValueSubsumedBy
Returns the minimal value among those associated to labels subsumed byl
if it exists,Constants.INT_NULL
otherwise.- Parameters:
l
- If it is null,Constants.INT_NULL
is returned.- Returns:
- minimal value among those associated to labels subsumed by
l
if it exists,Constants.INT_NULL
otherwise.
-
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 set must not be connected with the map.- Returns:
- a copy of all labels in the map.
-
keySet
it.unimi.dsi.fastutil.objects.ObjectSet<Label> keySet(it.unimi.dsi.fastutil.objects.ObjectSet<Label> setToReuse) - Parameters:
setToReuse
- a set to be reused for filling with the copy of labels- Returns:
- a copy of all labels in the map. The set must not be connected with the map.
-
newInstance
LabeledIntMap newInstance()Factory- Returns:
- an object of type LabeledIntMap.
-
newInstance
Factory- Parameters:
optimize
- true for having the label shortest 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
- an object to clone.- Returns:
- an object of type LabeledIntMap.
-
newInstance
Factory- Parameters:
lim
- an object to clone.optimize
- true for having the label shortest 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 valuei
if labell
is not null and there is not a 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 in order to minimize the labeled values present guaranteeing that no info is lost.
- Parameters:
l
- a not null label.i
- a notConstants.INT_NULL
value.- Returns:
- true if
(l,i)
has been inserted. Since an insertion can remove more than one redundant labeled values, 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
- aLabel
object.i
- the new value.
-
remove
Remove the labell
from the map. If thel
is not present, it does nothing.- Parameters:
l
- a not null label.- Returns:
- the previous value associated with
l
, orConstants.INT_NULL
if there was no mapping forl
. - See Also:
-
size
int size()- Returns:
- the number of labeled value (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 present in the map as an ordered list.
-