Klasse ManyToMany<T1,T2>
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.compiler.apt.util.ManyToMany<T1,T2>
Manage a MapUngültige Eingabe: "<"T1, Set>, with reverse links so that it is possible to
efficiently find all T1s that have a particular T2 associated with them.
Access to the map is synchronized, so that it is possible to read and
write simultaneously from multiple threads.
The map permits the null value for keys nor for value elements.
Design invariants preserved by all operations on this map are as follows:
- If a key exists, it has at least one value associated with it; that is, for all k such that null != containsKey(k), getValues(k) returns a non-empty set.
- If a value exists, it has at least one key associated with it; that is, for all v such that null != containsValue(v), getKeys(v) returns a non-empty set.
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungboolean
clear()
Empty all maps.void
Sets the dirty bit to false.boolean
containsKey
(T1 key) Equivalent to keySet().contains(key).boolean
containsKeyValuePair
(T1 key, T2 value) Is there a key that is mapped to the specified value?boolean
containsValue
(T2 value) Equivalent to values().contains(value).Search the reverse map for all keys that have been associated with a particular value.Search the forward map for all values associated with a particular key.boolean
isDirty()
Return the state of the dirty bit.boolean
keyHasOtherValues
(T1 key, T2 value) Check whetherkey
has an association to any values other thanvalue
- that is, whether the same key has been added with multiple values.boolean
Associate the specified value with the key.boolean
Remove a particular key-value association.boolean
Remove the key and its associated key/value entries.boolean
removeValue
(T2 value) Remove the value and its associated key/value entries.boolean
valueHasOtherKeys
(T2 value, T1 key) Check whethervalue
has an association from any keys other thankey
- that is, whether the same value has been added with multiple keys.
-
Konstruktordetails
-
ManyToMany
public ManyToMany()
-
-
Methodendetails
-
clear
public boolean clear()Empty all maps. If the maps previously contained entries, this will set the dirty bit.- Gibt zurück:
- true if the maps contained any entries prior to being cleared
-
clearDirtyBit
public void clearDirtyBit()Sets the dirty bit to false. Internal operations do not use the dirty bit; clearing it will not affect behavior of the map. It's just there for the convenience of callers who don't want to keep track of every put() and remove(). -
containsKey
Equivalent to keySet().contains(key).- Gibt zurück:
- true if the map contains the specified key.
-
containsKeyValuePair
Is there a key that is mapped to the specified value? Search within the forward map.- Gibt zurück:
- true if such a key exists
-
containsValue
Equivalent to values().contains(value).- Gibt zurück:
- true if the map contains the specified value (regardless of what key it might be associated with).
-
getKeys
Search the reverse map for all keys that have been associated with a particular value.- Gibt zurück:
- the set of keys that are associated with the specified value, or an empty set if the value does not exist in the map.
-
getValues
Search the forward map for all values associated with a particular key. Returns a copy of the set of values.- Gibt zurück:
- a copy of the set of values that are associated with the specified key, or an empty set if the key does not exist in the map.
-
getKeySet
- Gibt zurück:
- a copy of the set of all keys (that is, all items of type T1). If the maps are empty, the returned set will be empty, not null. The returned set can be modified by the caller without affecting the map.
- Siehe auch:
-
getValueSet
- Gibt zurück:
- a copy of the set of all values (that is, all items of type T2). If the maps are empty, the returned set will be empty, not null. The returned set can be modified by the caller without affecting the map.
- Siehe auch:
-
isDirty
public boolean isDirty()Return the state of the dirty bit. All operations that change the state of the maps, including @see #clear(), set the dirty bit if any content actually changed. The only way to clear the dirty bit is to call @see #clearDirtyBit().- Gibt zurück:
- true if the map content has changed since it was created or since the last call to clearDirtyBit().
- Siehe auch:
-
keyHasOtherValues
Check whetherkey
has an association to any values other thanvalue
- that is, whether the same key has been added with multiple values. Equivalent to asking whether the intersection ofgetValues(key)
and the set containingvalue
is non-empty.- Gibt zurück:
- true iff
key
is in the map and is associated with values other thanvalue
. - Siehe auch:
-
put
Associate the specified value with the key. Adds the entry to both the forward and reverse maps. Adding the same value twice to a particular key has no effect. Because this is a many-to-many map, adding a new value for an existing key does not change the existing association, it adds a new one.- Parameter:
key
- can be nullvalue
- can be null- Gibt zurück:
- true if the key/value pair did not exist prior to being added
-
remove
Remove a particular key-value association. This is the inverse of put(key, value). If the key does not exist, or the value does not exist, or the association does not exist, this call has no effect.- Gibt zurück:
- true if the key/value pair existed in the map prior to removal
-
removeKey
Remove the key and its associated key/value entries. Calling removeKey(k) is equivalent to calling remove(k,v) for every v in getValues(k).- Gibt zurück:
- true if the key existed in the map prior to removal
-
removeValue
Remove the value and its associated key/value entries. Calling removeValue(v) is equivalent to calling remove(k,v) for every k in getKeys(v).- Gibt zurück:
- true if the value existed in the map prior to removal.
-
valueHasOtherKeys
Check whethervalue
has an association from any keys other thankey
- that is, whether the same value has been added with multiple keys. Equivalent to asking whether the intersection ofgetKeys(value)
and the set containingkey
is non-empty.- Gibt zurück:
- true iff
value
is in the map and is associated with keys other thankey
. - Siehe auch:
-