org.eclipse.ocl.ecore.opposites
Class ExtentMap

java.lang.Object
  extended by org.eclipse.ocl.ecore.opposites.ExtentMap
All Implemented Interfaces:
java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>

public class ExtentMap
extends java.lang.Object
implements java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>

Uses OppositeEndFinder.getAllInstancesSeenBy(EClass, org.eclipse.emf.common.notify.Notifier) to perform an extent lookup that is consistent with the visibility rules implemented by the OppositeEndFinder for hidden opposites lookup and traversal.

Usage:

   OCL.setExtentMap(new ExtentMap(context, oppositeEndFinder))
 
in case there is a specific OppositeEndFinder to be used. In order to use the DefaultOppositeEndFinder, use
   OCL.setExtentMap(new ExtentMap(context))
 

Since:
3.1

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
ExtentMap(org.eclipse.emf.common.notify.Notifier context)
          Uses a DefaultOppositeEndFinder
ExtentMap(org.eclipse.emf.common.notify.Notifier context, OppositeEndFinder oppositeEndFinder)
           
 
Method Summary
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set<java.util.Map.Entry<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>> entrySet()
           
 java.util.Set<org.eclipse.emf.ecore.EObject> get(java.lang.Object cls)
          Computes the extent of the specified class key based on a forward lookup on the OppositeEndFinder passed to this map during construction.
 boolean isEmpty()
           
 java.util.Set<org.eclipse.emf.ecore.EClass> keySet()
           
 java.util.Set<org.eclipse.emf.ecore.EObject> put(org.eclipse.emf.ecore.EClass key, java.util.Set<org.eclipse.emf.ecore.EObject> value)
           
 void putAll(java.util.Map<? extends org.eclipse.emf.ecore.EClass,? extends java.util.Set<org.eclipse.emf.ecore.EObject>> m)
           
 java.util.Set<org.eclipse.emf.ecore.EObject> remove(java.lang.Object key)
           
 int size()
           
 java.util.Collection<java.util.Set<org.eclipse.emf.ecore.EObject>> values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

ExtentMap

public ExtentMap(org.eclipse.emf.common.notify.Notifier context,
                 OppositeEndFinder oppositeEndFinder)

ExtentMap

public ExtentMap(org.eclipse.emf.common.notify.Notifier context)
Uses a DefaultOppositeEndFinder

Parameters:
context - the EObject, Resource or ResourceSet relative to which the visibility rules are evaluated.
Method Detail

get

public java.util.Set<org.eclipse.emf.ecore.EObject> get(java.lang.Object cls)
Computes the extent of the specified class key based on a forward lookup on the OppositeEndFinder passed to this map during construction. The collection returned is backed by the underlying map, meaning that additions to cls's extent add to the collection returned, and removals from the extent remove from the collection.

Specified by:
get in interface java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>
Parameters:
cls - a class in the model

size

public int size()
Specified by:
size in interface java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>

put

public java.util.Set<org.eclipse.emf.ecore.EObject> put(org.eclipse.emf.ecore.EClass key,
                                                        java.util.Set<org.eclipse.emf.ecore.EObject> value)
Specified by:
put in interface java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>

remove

public java.util.Set<org.eclipse.emf.ecore.EObject> remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>

putAll

public void putAll(java.util.Map<? extends org.eclipse.emf.ecore.EClass,? extends java.util.Set<org.eclipse.emf.ecore.EObject>> m)
Specified by:
putAll in interface java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>

clear

public void clear()
Specified by:
clear in interface java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>

keySet

public java.util.Set<org.eclipse.emf.ecore.EClass> keySet()
Specified by:
keySet in interface java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>

values

public java.util.Collection<java.util.Set<org.eclipse.emf.ecore.EObject>> values()
Specified by:
values in interface java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>

entrySet

public java.util.Set<java.util.Map.Entry<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>> entrySet()
Specified by:
entrySet in interface java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Set<org.eclipse.emf.ecore.EObject>>