Klasse ManyToMany<T1,T2>

java.lang.Object
org.aspectj.org.eclipse.jdt.internal.compiler.apt.util.ManyToMany<T1,T2>

public class ManyToMany<T1,T2> extends Object
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

    Konstruktoren
    Konstruktor
    Beschreibung
     
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    boolean
    Empty all maps.
    void
    Sets the dirty bit to false.
    boolean
    Equivalent to keySet().contains(key).
    boolean
    containsKeyValuePair(T1 key, T2 value)
    Is there a key that is mapped to the specified value?
    boolean
    Equivalent to values().contains(value).
    getKeys(T2 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
    Return the state of the dirty bit.
    boolean
    keyHasOtherValues(T1 key, T2 value)
    Check whether key has an association to any values other than value - that is, whether the same key has been added with multiple values.
    boolean
    put(T1 key, T2 value)
    Associate the specified value with the key.
    boolean
    remove(T1 key, T2 value)
    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 whether value has an association from any keys other than key - that is, whether the same value has been added with multiple keys.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public boolean containsKey(T1 key)
      Equivalent to keySet().contains(key).
      Gibt zurück:
      true if the map contains the specified key.
    • containsKeyValuePair

      public boolean containsKeyValuePair(T1 key, T2 value)
      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

      public boolean containsValue(T2 value)
      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

      public Set<T1> getKeys(T2 value)
      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

      public Set<T2> getValues(T1 key)
      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

      public Set<T1> 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

      public Set<T2> 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

      public boolean keyHasOtherValues(T1 key, T2 value)
      Check whether key has an association to any values other than value - that is, whether the same key has been added with multiple values. Equivalent to asking whether the intersection of getValues(key) and the set containing value is non-empty.
      Gibt zurück:
      true iff key is in the map and is associated with values other than value.
      Siehe auch:
    • put

      public boolean put(T1 key, T2 value)
      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 null
      value - can be null
      Gibt zurück:
      true if the key/value pair did not exist prior to being added
    • remove

      public boolean remove(T1 key, T2 value)
      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

      public boolean removeKey(T1 key)
      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

      public boolean removeValue(T2 value)
      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

      public boolean valueHasOtherKeys(T2 value, T1 key)
      Check whether value has an association from any keys other than key - that is, whether the same value has been added with multiple keys. Equivalent to asking whether the intersection of getKeys(value) and the set containing key is non-empty.
      Gibt zurück:
      true iff value is in the map and is associated with keys other than key.
      Siehe auch: