org.eclipse.emf.ecore.util
Class EcoreEMap<K,V>

java.lang.Object
  extended by org.eclipse.emf.common.util.BasicEMap<K,V>
      extended by org.eclipse.emf.ecore.util.EcoreEMap<K,V>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.util.Map.Entry<K,V>>, java.util.Collection<java.util.Map.Entry<K,V>>, java.util.List<java.util.Map.Entry<K,V>>, EList<java.util.Map.Entry<K,V>>, EMap<K,V>, EStructuralFeature.Setting, InternalEList<java.util.Map.Entry<K,V>>, InternalEList.Unsettable<java.util.Map.Entry<K,V>>
Direct Known Subclasses:
EcoreEMap.Unsettable

public class EcoreEMap<K,V>
extends BasicEMap<K,V>
implements InternalEList.Unsettable<java.util.Map.Entry<K,V>>, EStructuralFeature.Setting

See Also:
Serialized Form

Nested Class Summary
protected  class EcoreEMap.DelegateEObjectContainmentEList<E extends java.lang.Object & BasicEMap.Entry<K,V>>
           
static class EcoreEMap.Unsettable<K,V>
           
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.util.BasicEMap
BasicEMap.BasicEMapIterator<U>, BasicEMap.BasicEMapKeyIterator, BasicEMap.BasicEMapValueIterator, BasicEMap.DelegatingMap, BasicEMap.Entry<K,V>, BasicEMap.EntryImpl, BasicEMap.View<K,V>
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.util.EMap
EMap.InternalMapView<K,V>
 
Field Summary
protected  java.lang.Class<?> entryClass
           
protected  EClass entryEClass
           
 
Fields inherited from class org.eclipse.emf.common.util.BasicEMap
delegateEList, entryData, modCount, size, view
 
Constructor Summary
EcoreEMap(EClass entryEClass, java.lang.Class<?> entryClass, EList<BasicEMap.Entry<K,V>> delegateEList)
           
EcoreEMap(EClass entryEClass, java.lang.Class<?> entryClass, InternalEObject owner, int featureID)
           
 
Method Summary
 boolean addAllUnique(java.util.Collection<? extends java.util.Map.Entry<K,V>> collection)
          Add the objects without verifying uniqueness.
 boolean addAllUnique(int index, java.util.Collection<? extends java.util.Map.Entry<K,V>> collection)
          Add the objects without verifying uniqueness.
 void addUnique(int index, java.util.Map.Entry<K,V> object)
          Add the object without verifying uniqueness.
 void addUnique(java.util.Map.Entry<K,V> object)
          Add the object without verifying uniqueness.
 NotificationChain basicAdd(java.util.Map.Entry<K,V> object, NotificationChain notifications)
          Add the object without updating the inverse.
 boolean basicContains(java.lang.Object object)
          Returns whether the object is contained within the list of unresolved values.
 boolean basicContainsAll(java.util.Collection<?> collection)
          Returns whether each object in the collection is contained within the list of unresolved values.
 BasicEMap.Entry<K,V> basicGet(int index)
          Returns the unresolved value.
 int basicIndexOf(java.lang.Object object)
          Returns the index of the object within the list of unresolved values.
 java.util.Iterator<java.util.Map.Entry<K,V>> basicIterator()
          Returns an iterator that yields unresolved values.
 int basicLastIndexOf(java.lang.Object object)
          Returns the last index of the object within the list of unresolved values.
 java.util.List<java.util.Map.Entry<K,V>> basicList()
          Returns an unmodifiable list that yields unresolved values.
 java.util.ListIterator<java.util.Map.Entry<K,V>> basicListIterator()
          Returns a list iterator that yields unresolved values.
 java.util.ListIterator<java.util.Map.Entry<K,V>> basicListIterator(int index)
          Returns a list iterator that yields unresolved values.
 NotificationChain basicRemove(java.lang.Object object, NotificationChain notifications)
          Remove the object with without updating the inverse.
 java.lang.Object[] basicToArray()
          Returns the array with unresolved values.
<T> T[]
basicToArray(T[] array)
          Returns the array with unresolved values.
 java.lang.Object get(boolean resolve)
          Returns the value held by the feature of the object; it optionally resolves the value.
 EObject getEObject()
          Returns the object holding a value.
 EStructuralFeature getEStructuralFeature()
          Returns the specific feature holding a value for the object.
protected  void initializeDelegateEList()
          Initializes the BasicEMap.delegateEList.
 boolean isSet()
          Returns whether a value is held by the feature of the object.
protected  BasicEMap.Entry<K,V> newEntry(int hash, K key, V value)
          Returns a new entry.
protected  BasicEList<BasicEMap.Entry<K,V>> newList()
          Returns a new allocated list of entries.
 void set(java.lang.Object value)
          Set the value held by the feature of the object.
 java.util.Map.Entry<K,V> setUnique(int index, java.util.Map.Entry<K,V> object)
          Set the object without verifying uniqueness.
 void unset()
          Unsets the value held by the feature of the object.
 
Methods inherited from class org.eclipse.emf.common.util.BasicEMap
add, add, addAll, addAll, clear, clone, contains, containsAll, containsKey, containsValue, didAdd, didClear, didModify, didRemove, doClear, doMove, doPut, doRemove, ensureEntryDataExists, entryForKey, entryIndexForKey, entrySet, equals, get, get, grow, hashCode, hashOf, indexOf, indexOf, indexOfKey, isEmpty, iterator, keySet, lastIndexOf, listIterator, listIterator, map, move, move, newEntryData, put, putAll, putAll, putEntry, remove, remove, removeAll, removeEntry, removeKey, resolve, retainAll, set, size, subList, toArray, toArray, toString, useEqualsForKey, useEqualsForValue, validateKey, validateValue, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.common.util.EList
move, move
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Field Detail

entryEClass

protected EClass entryEClass

entryClass

protected java.lang.Class<?> entryClass
Constructor Detail

EcoreEMap

public EcoreEMap(EClass entryEClass,
                 java.lang.Class<?> entryClass,
                 InternalEObject owner,
                 int featureID)

EcoreEMap

public EcoreEMap(EClass entryEClass,
                 java.lang.Class<?> entryClass,
                 EList<BasicEMap.Entry<K,V>> delegateEList)
Method Detail

initializeDelegateEList

protected void initializeDelegateEList()
Description copied from class: BasicEMap
Initializes the BasicEMap.delegateEList. This implementation illustrates the precise pattern that is used to delegate a list implementation's callback methods to the map implementation.

Overrides:
initializeDelegateEList in class BasicEMap<K,V>

newList

protected BasicEList<BasicEMap.Entry<K,V>> newList()
Description copied from class: BasicEMap
Returns a new allocated list of entries. Clients may override this to create typed storage. The cost of type checking via a typed array is negligible. The type must be kept in synch with newEntry.

Overrides:
newList in class BasicEMap<K,V>
Returns:
a new list of entries.
See Also:
BasicEMap.newEntry(int, Object, Object)

newEntry

protected BasicEMap.Entry<K,V> newEntry(int hash,
                                        K key,
                                        V value)
Description copied from class: BasicEMap
Returns a new entry. The key is validated and the value is validated. Clients may override this to create typed storage. The type must be kept in synch with newEntry.

Overrides:
newEntry in class BasicEMap<K,V>
Parameters:
hash - the cached hash code of the key.
key - the key.
value - the value.
Returns:
a new entry.
See Also:
BasicEMap.newList()

basicGet

public BasicEMap.Entry<K,V> basicGet(int index)
Description copied from interface: InternalEList
Returns the unresolved value.

Specified by:
basicGet in interface InternalEList<java.util.Map.Entry<K,V>>

basicList

public java.util.List<java.util.Map.Entry<K,V>> basicList()
Description copied from interface: InternalEList
Returns an unmodifiable list that yields unresolved values.

Specified by:
basicList in interface InternalEList<java.util.Map.Entry<K,V>>

basicIterator

public java.util.Iterator<java.util.Map.Entry<K,V>> basicIterator()
Returns an iterator that yields unresolved values.

Specified by:
basicIterator in interface InternalEList<java.util.Map.Entry<K,V>>

basicListIterator

public java.util.ListIterator<java.util.Map.Entry<K,V>> basicListIterator()
Returns a list iterator that yields unresolved values.

Specified by:
basicListIterator in interface InternalEList<java.util.Map.Entry<K,V>>

basicListIterator

public java.util.ListIterator<java.util.Map.Entry<K,V>> basicListIterator(int index)
Returns a list iterator that yields unresolved values.

Specified by:
basicListIterator in interface InternalEList<java.util.Map.Entry<K,V>>

basicContains

public boolean basicContains(java.lang.Object object)
Description copied from interface: InternalEList
Returns whether the object is contained within the list of unresolved values.

Specified by:
basicContains in interface InternalEList<java.util.Map.Entry<K,V>>

basicContainsAll

public boolean basicContainsAll(java.util.Collection<?> collection)
Description copied from interface: InternalEList
Returns whether each object in the collection is contained within the list of unresolved values.

Specified by:
basicContainsAll in interface InternalEList<java.util.Map.Entry<K,V>>

basicIndexOf

public int basicIndexOf(java.lang.Object object)
Description copied from interface: InternalEList
Returns the index of the object within the list of unresolved values.

Specified by:
basicIndexOf in interface InternalEList<java.util.Map.Entry<K,V>>

basicLastIndexOf

public int basicLastIndexOf(java.lang.Object object)
Description copied from interface: InternalEList
Returns the last index of the object within the list of unresolved values.

Specified by:
basicLastIndexOf in interface InternalEList<java.util.Map.Entry<K,V>>

basicToArray

public java.lang.Object[] basicToArray()
Returns the array with unresolved values.

Specified by:
basicToArray in interface InternalEList<java.util.Map.Entry<K,V>>

basicToArray

public <T> T[] basicToArray(T[] array)
Returns the array with unresolved values.

Specified by:
basicToArray in interface InternalEList<java.util.Map.Entry<K,V>>

basicRemove

public NotificationChain basicRemove(java.lang.Object object,
                                     NotificationChain notifications)
Remove the object with without updating the inverse.

Specified by:
basicRemove in interface InternalEList<java.util.Map.Entry<K,V>>

basicAdd

public NotificationChain basicAdd(java.util.Map.Entry<K,V> object,
                                  NotificationChain notifications)
Add the object without updating the inverse.

Specified by:
basicAdd in interface InternalEList<java.util.Map.Entry<K,V>>

addUnique

public void addUnique(java.util.Map.Entry<K,V> object)
Add the object without verifying uniqueness.

Specified by:
addUnique in interface InternalEList<java.util.Map.Entry<K,V>>

addUnique

public void addUnique(int index,
                      java.util.Map.Entry<K,V> object)
Add the object without verifying uniqueness.

Specified by:
addUnique in interface InternalEList<java.util.Map.Entry<K,V>>

addAllUnique

public boolean addAllUnique(java.util.Collection<? extends java.util.Map.Entry<K,V>> collection)
Add the objects without verifying uniqueness.

Specified by:
addAllUnique in interface InternalEList<java.util.Map.Entry<K,V>>

addAllUnique

public boolean addAllUnique(int index,
                            java.util.Collection<? extends java.util.Map.Entry<K,V>> collection)
Add the objects without verifying uniqueness.

Specified by:
addAllUnique in interface InternalEList<java.util.Map.Entry<K,V>>

setUnique

public java.util.Map.Entry<K,V> setUnique(int index,
                                          java.util.Map.Entry<K,V> object)
Set the object without verifying uniqueness.

Specified by:
setUnique in interface InternalEList<java.util.Map.Entry<K,V>>

getEObject

public EObject getEObject()
Description copied from interface: EStructuralFeature.Setting
Returns the object holding a value.

Specified by:
getEObject in interface EStructuralFeature.Setting
Returns:
the object holding a value.

getEStructuralFeature

public EStructuralFeature getEStructuralFeature()
Description copied from interface: EStructuralFeature.Setting
Returns the specific feature holding a value for the object.

Specified by:
getEStructuralFeature in interface EStructuralFeature.Setting
Returns:
the specific feature holding a value for the object.

get

public java.lang.Object get(boolean resolve)
Description copied from interface: EStructuralFeature.Setting
Returns the value held by the feature of the object; it optionally resolves the value.

Specified by:
get in interface EStructuralFeature.Setting
Parameters:
resolve - whether to resolve.
Returns:
the value held by the feature of the object.
See Also:
EObject.eGet(EStructuralFeature, boolean)

set

public void set(java.lang.Object value)
Description copied from interface: EStructuralFeature.Setting
Set the value held by the feature of the object. If the new value is this setting itself, or is modified as a side effect of modifying this setting (i.e., if it is a view on the setting), the behavior is undefined and will likely result in simply clearing the list.

Specified by:
set in interface EStructuralFeature.Setting
Parameters:
value - the newValue.
See Also:
EObject.eSet(EStructuralFeature, Object)

isSet

public boolean isSet()
Description copied from interface: EStructuralFeature.Setting
Returns whether a value is held by the feature of the object.

Specified by:
isSet in interface EStructuralFeature.Setting
Specified by:
isSet in interface InternalEList.Unsettable<java.util.Map.Entry<K,V>>
Returns:
whether a value is held by the feature of the object.
See Also:
EObject.eIsSet(EStructuralFeature)

unset

public void unset()
Description copied from interface: EStructuralFeature.Setting
Unsets the value held by the feature of the object.

Specified by:
unset in interface EStructuralFeature.Setting
Specified by:
unset in interface InternalEList.Unsettable<java.util.Map.Entry<K,V>>
See Also:
EObject.eUnset(EStructuralFeature)

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.