Package it.univr.di.labeledvalue.lazy
Class LabeledLazyWeightTreeMap
java.lang.Object
it.univr.di.labeledvalue.lazy.LabeledLazyWeightTreeMap
public class LabeledLazyWeightTreeMap extends Object
Simple implementation of
LabeledLazyWeightTreeMap
interface using LazyWieght instead of int.- Version:
- $Id: $Id
- Author:
- Roberto Posenato
- See Also:
LabeledLazyWeightTreeMap
-
Field Summary
Fields Modifier and Type Field Description static Comparator<it.unimi.dsi.fastutil.objects.Object2ObjectMap.Entry<Label,LazyWeight>>
entryComparator
A natural comparator for Entry<Label>.static String
lazyWeightLabelSeparator
-
Constructor Summary
Constructors Constructor Description LabeledLazyWeightTreeMap()
Necessary constructor for the factory.LabeledLazyWeightTreeMap(LabeledLazyWeightTreeMap lvm)
Constructor to clone the structure. -
Method Summary
Modifier and Type Method Description boolean
alreadyRepresents(Label newLabel, LazyWeight newLW)
void
clear()
static LabeledLazyWeightTreeMap
createLabeledLazyTreeMap()
static LabeledLazyWeightTreeMap
createLabeledLazyTreeMap(LabeledLazyWeightTreeMap lim)
static String
entryAsString(Label label, LazyWeight value)
it.unimi.dsi.fastutil.objects.ObjectSet<it.unimi.dsi.fastutil.objects.Object2ObjectMap.Entry<Label,LazyWeight>>
entrySet()
Up to 1000 items in the map it is better to useentrySet()
instead ofkeySet()
and, then,get(Label)
.it.unimi.dsi.fastutil.objects.ObjectSet<it.unimi.dsi.fastutil.objects.Object2ObjectMap.Entry<Label,LazyWeight>>
entrySet(it.unimi.dsi.fastutil.objects.ObjectSet<it.unimi.dsi.fastutil.objects.Object2ObjectMap.Entry<Label,LazyWeight>> setToReuse)
boolean
equals(Object o)
LazyWeight
get(Label l)
double
getInt(Label l)
double
getMaxValue()
double
getMinValue()
double
getMinValueConsistentWith(Label l)
double
getMinValueSubsumedBy(Label l)
int
hashCode()
it.unimi.dsi.fastutil.objects.ObjectSet<Label>
keySet()
it.unimi.dsi.fastutil.objects.ObjectSet<Label>
keySet(it.unimi.dsi.fastutil.objects.ObjectSet<Label> setToReuse)
static void
main(String[] args)
static LabeledLazyWeightTreeMap
parse(String inputMap)
Parse a string representing a LabeledLazyWeightTreeMap and return an object containing the labeled values represented by the string.
The format of the string is:boolean
put(Label newLabel, LazyWeight newLW)
Adds the pair 〈l,i〉.
Moreover, tries to eliminate all labels that are redundant.
IMPORTANT!
This version of the method is very redundant but simple to check!double
putForcibly(Label l, LazyWeight lw)
double
remove(Label l)
int
size()
String
toString()
it.unimi.dsi.fastutil.doubles.DoubleSet
values()
-
Field Details
-
entryComparator
public static Comparator<it.unimi.dsi.fastutil.objects.Object2ObjectMap.Entry<Label,LazyWeight>> entryComparatorA natural comparator for Entry<Label>. It orders considering the alphabetical order of Label. -
lazyWeightLabelSeparator
- See Also:
- Constant Field Values
-
-
Constructor Details
-
LabeledLazyWeightTreeMap
public LabeledLazyWeightTreeMap()Necessary constructor for the factory. The internal structure is built and empty. -
LabeledLazyWeightTreeMap
Constructor to clone the structure. For optimization issue, this method clone only LabeledIntTreeMap object.- Parameters:
lvm
- the LabeledValueTreeMap to clone. If lvm is null, this will be a empty map.
-
-
Method Details
-
createLabeledLazyTreeMap
-
createLabeledLazyTreeMap
-
entryAsString
- Parameters:
value
-label
-- Returns:
- string representing the labeled value, i.e., "(value, label)"
-
parse
Parse a string representing a LabeledLazyWeightTreeMap and return an object containing the labeled values represented by the string.
The format of the string is:\{[\(<lazyWeight>, <key>\) ]*\}
where a lazyWeight can be an integer or a linear function (multiplier factor and constant, both integer, separated by a space), i.e.,<integer> | <multiplier constant>
- Parameters:
inputMap
- aString
object.- Returns:
- a LabeledValueTreeMap object if
inputMap
represents a valid map, null otherwise.
-
alreadyRepresents
- Parameters:
newLabel
-newLW
-- Returns:
- true if the current map can represent the value. In positive case, an addition of the element does not change the map. If returns false, then an addition of the value to the map would modify the map.
-
clear
public void clear() -
entrySet
public it.unimi.dsi.fastutil.objects.ObjectSet<it.unimi.dsi.fastutil.objects.Object2ObjectMap.Entry<Label,LazyWeight>> entrySet()Up to 1000 items in the map it is better to useentrySet()
instead ofkeySet()
and, then,get(Label)
. With 1000 or more items, it is better to usekeySet()
approach.- Returns:
- a set view of all elements.
-
entrySet
public it.unimi.dsi.fastutil.objects.ObjectSet<it.unimi.dsi.fastutil.objects.Object2ObjectMap.Entry<Label,LazyWeight>> entrySet(it.unimi.dsi.fastutil.objects.ObjectSet<it.unimi.dsi.fastutil.objects.Object2ObjectMap.Entry<Label,LazyWeight>> setToReuse) -
equals
-
get
-
getInt
-
getMaxValue
public double getMaxValue() -
getMinValue
public double getMinValue() -
getMinValueSubsumedBy
-
getMinValueConsistentWith
-
hashCode
public int hashCode() -
keySet
- Returns:
- a set view of all labels present into this map.
-
keySet
public it.unimi.dsi.fastutil.objects.ObjectSet<Label> keySet(it.unimi.dsi.fastutil.objects.ObjectSet<Label> setToReuse)- Parameters:
setToReuse
-- Returns:
- a set view of all labels present into this map.
-
put
Adds the pair 〈l,i〉.
Moreover, tries to eliminate all labels that are redundant.
IMPORTANT!
This version of the method is very redundant but simple to check!- Parameters:
newLabel
-newLW
-- Returns:
- true if the LW has been inserted.
-
putForcibly
- Parameters:
l
-lw
-- Returns:
- previous value if present, Constants.INT_NULL otherwise;
-
remove
-
size
public int size() -
toString
-
values
public it.unimi.dsi.fastutil.doubles.DoubleSet values() -
main
-