Package ghidra.generic.util.datastruct
Class RestrictedValueSortedMap<K,V>
java.lang.Object
ghidra.generic.util.datastruct.RestrictedValueSortedMap<K,V>
- Type Parameters:
K
- the type of keysV
- the type of values
- All Implemented Interfaces:
ValueSortedMap<K,
V>
A view of the value-sorted map for implementing
subMapByValue(Object, boolean, Object, boolean)
, etc.-
Nested Class Summary
Modifier and TypeClassDescriptionclass
A list iterator suitable forList.listIterator()
, etc., on the entries of aRestrictedValueSortedMap
class
A list iterator suitable forList.listIterator()
, etc., on the keys of aRestrictedValueSortedMap
class
A list view suitable forValueSortedMap.values()
ofRestrictedValueSortedMap
class
A list iterator suitable forList.listIterator()
, etc., on the values of aRestrictedValueSortedMap
class
A list view suitable forValueSortedMap.entrySet()
ofRestrictedValueSortedMap
class
A list view suitable forValueSortedMap.keySet()
ofRestrictedValueSortedMap
Nested classes/interfaces inherited from interface ghidra.generic.util.datastruct.ValueSortedMap
ValueSortedMap.LesserList<E>, ValueSortedMap.ValueSortedMapEntryList<K,
V>, ValueSortedMap.ValueSortedMapKeyList<K> -
Constructor Summary
ModifierConstructorDescriptionprotected
RestrictedValueSortedMap
(ValueSortedMap<K, V> wrapped, Comparator<V> comparator, boolean hasFrom, V fromValue, boolean fromInclusive, boolean hasTo, V toValue, boolean toInclusive) Construct a restricted view of a value-sorted map -
Method Summary
Modifier and TypeMethodDescriptionceilingEntryByValue
(V value) Returns a key-value mapping associated with the least value greater than or equal to the given value, ornull
if there is no such value.void
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
floorEntryByValue
(V value) Returns a key-value mapping associated with the greatest value less than or equal to the given value, ornull
if there is no such value.protected int
protected int
headMapByValue
(V toValue, boolean inclusive) Returns a view of the portion of this map whose values are less than (or equal to, ifinclusive
is true)toValue
.higherEntryByValue
(V value) Returns a key-value mapping associated with the least value strictly greater than the given value, ornull
if there is no such value.protected boolean
protected int
inBoundsOrNeg1
(int index) inBoundsOrNull
(Map.Entry<K, V> ent) protected V
inBoundsOrNull
(V val) boolean
isEmpty()
keySet()
lowerEntryByValue
(V value) Returns a key-value mapping associated with the greatest value strictly less than the given value, ornull
if there is no such value.protected boolean
protected int
int
size()
subMapByValue
(V fromValue, boolean fromInclusive, V toValue, boolean toInclusive) Returns a view of the portion of this map whose values range fromfromValue
totoValue
.tailMapByValue
(V fromValue, boolean inclusive) Returns a view of the portion of this map whose values are greater than (or equal to, ifinclusive
is true)toValue
.boolean
Notify the map of an external change to the cost of a key's associated valuevalues()
-
Constructor Details
-
RestrictedValueSortedMap
protected RestrictedValueSortedMap(ValueSortedMap<K, V> wrapped, Comparator<V> comparator, boolean hasFrom, V fromValue, boolean fromInclusive, boolean hasTo, V toValue, boolean toInclusive) Construct a restricted view of a value-sorted map- Parameters:
wrapped
- the value-sorted map to restrictcomparator
- the value comparatorhasFrom
- true if there exists a lower boundfromValue
- the lower bound, if presentfromInclusive
- true to include the lower boundhasTo
- true if there exists an upper boundtoValue
- the upper bound, if presenttoInclusive
- true to include the upper bound
-
-
Method Details
-
getLowestIndex
protected int getLowestIndex() -
getHighestIndexPlusOne
protected int getHighestIndexPlusOne() -
size
public int size()- Specified by:
size
in interfaceValueSortedMap<K,
V>
-
inBoundsOrNeg1
protected int inBoundsOrNeg1(int index) -
restrictedSize
protected int restrictedSize() -
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceValueSortedMap<K,
V>
-
restrictedIsEmpty
protected boolean restrictedIsEmpty() -
inBounds
-
inBoundsOrNull
-
inBoundsOrNull
-
containsKey
- Specified by:
containsKey
in interfaceValueSortedMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceValueSortedMap<K,
V>
-
get
- Specified by:
get
in interfaceValueSortedMap<K,
V>
-
put
- Specified by:
put
in interfaceValueSortedMap<K,
V>
-
remove
- Specified by:
remove
in interfaceValueSortedMap<K,
V>
-
clear
public void clear()- Specified by:
clear
in interfaceValueSortedMap<K,
V>
-
entrySet
- Specified by:
entrySet
in interfaceValueSortedMap<K,
V>
-
lowerEntryByValue
Description copied from interface:ValueSortedMap
Returns a key-value mapping associated with the greatest value strictly less than the given value, ornull
if there is no such value.- Specified by:
lowerEntryByValue
in interfaceValueSortedMap<K,
V> - Parameters:
value
- the value- Returns:
- the found entry, or
null
-
floorEntryByValue
Description copied from interface:ValueSortedMap
Returns a key-value mapping associated with the greatest value less than or equal to the given value, ornull
if there is no such value.- Specified by:
floorEntryByValue
in interfaceValueSortedMap<K,
V> - Parameters:
value
- the value- Returns:
- the found entry, or
null
-
ceilingEntryByValue
Description copied from interface:ValueSortedMap
Returns a key-value mapping associated with the least value greater than or equal to the given value, ornull
if there is no such value.- Specified by:
ceilingEntryByValue
in interfaceValueSortedMap<K,
V> - Parameters:
value
- the value- Returns:
- the found entry, or
null
-
higherEntryByValue
Description copied from interface:ValueSortedMap
Returns a key-value mapping associated with the least value strictly greater than the given value, ornull
if there is no such value.- Specified by:
higherEntryByValue
in interfaceValueSortedMap<K,
V> - Parameters:
value
- the value- Returns:
- the found entry, or
null
-
subMapByValue
public ValueSortedMap<K,V> subMapByValue(V fromValue, boolean fromInclusive, V toValue, boolean toInclusive) Description copied from interface:ValueSortedMap
Returns a view of the portion of this map whose values range fromfromValue
totoValue
. The returned map is an unmodifiable view.- Specified by:
subMapByValue
in interfaceValueSortedMap<K,
V> - Parameters:
fromValue
- low endpoint of the values in the returned mapfromInclusive
-true
if the low endpoint is to be included in the returned viewtoValue
- high endpoint of the values in the returned maptoInclusive
-true
if the high endpoint is to be included in the returned view- Returns:
- the view
-
headMapByValue
Description copied from interface:ValueSortedMap
Returns a view of the portion of this map whose values are less than (or equal to, ifinclusive
is true)toValue
. The returned map is an unmodifiable view.- Specified by:
headMapByValue
in interfaceValueSortedMap<K,
V> - Parameters:
toValue
- high endpoint of the values in the returned mapinclusive
-true
if the high endpoint is to be included in the returned view- Returns:
- the view
-
tailMapByValue
Description copied from interface:ValueSortedMap
Returns a view of the portion of this map whose values are greater than (or equal to, ifinclusive
is true)toValue
. The returned map is an unmodifiable view.- Specified by:
tailMapByValue
in interfaceValueSortedMap<K,
V> - Parameters:
fromValue
- low endpoint of the values in the returned mapinclusive
-true
if the low endpoint is to be included in the returned view- Returns:
- the view
-
keySet
- Specified by:
keySet
in interfaceValueSortedMap<K,
V>
-
update
Description copied from interface:ValueSortedMap
Notify the map of an external change to the cost of a key's associated valueThis is meant to update the entry's position after a change in cost. The position may not necessarily change, however, if the cost did not change significantly.
- Specified by:
update
in interfaceValueSortedMap<K,
V> - Parameters:
key
- the key whose associated value has changed in cost- Returns:
- true if the entry's position changed
-
values
- Specified by:
values
in interfaceValueSortedMap<K,
V>
-