|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<E> java.util.AbstractSet<E> java.util.HashSet<E> java.util.LinkedHashSet<EObject> org.eclipse.emf.henshin.interpreter.impl.EGraphImpl
public class EGraphImpl
Default EGraph
implementation. Based on linked hash sets.
Field Summary | |
---|---|
protected ECrossReferenceAdapter |
crossReferenceAdapter
Cross reference adapter for determining cross references between registered objects. |
protected Map<EClass,List<EObject>> |
domainMap
Mappings from each type to all its instances. |
protected Map<EClass,Set<EClass>> |
inheritanceMap
Mappings from each type to all its extending subtypes. |
protected Set<EPackage> |
packages
All involved EPackages. |
Constructor Summary | |
---|---|
EGraphImpl()
Default constructor. |
|
EGraphImpl(Collection<? extends EObject> collection)
Convenience constructor. |
|
EGraphImpl(EObject object)
Convenience constructor. |
|
EGraphImpl(int initialCapacity)
Constructor. |
|
EGraphImpl(Resource resource)
Convenience constructor. |
Method Summary | |
---|---|
boolean |
add(EObject object)
|
boolean |
addAll(Collection<? extends EObject> objs)
|
protected void |
addChildParentRelation(EClass child,
EClass parent)
Update the inheritance map. |
protected boolean |
addEPackage(EPackage ePackage)
Add an EPackage . |
boolean |
addGraph(EObject object)
Adds an EObject and all reachable objects to this graph. |
boolean |
addTree(EObject root)
Adds an EObject and all its children to this graph. |
void |
clear()
|
EGraph |
copy(Map<EObject,EObject> copies)
Copy this object graph. |
protected void |
didAdd(EObject object)
Notify that an object has been added to the graph. |
protected void |
didRemove(EObject object)
Notify that an object has been removed from the graph. |
ECrossReferenceAdapter |
getCrossReferenceAdapter()
Get the cross reference adapter of this graph. |
protected Collection<EObject> |
getDomain(EClass type)
|
List<EObject> |
getDomain(EClass type,
boolean strict)
Get all EObject s of this graph which are compatible with the given type. |
int |
getDomainSize(EClass type,
boolean strict)
Returns the size of the domain for a type. |
List<EObject> |
getRoots()
Get the root objects in this graph. |
protected void |
initializeContents(Collection<? extends EObject> collection)
Initialize this EGraph. |
boolean |
remove(Object object)
|
boolean |
removeAll(Collection<?> objs)
|
boolean |
removeGraph(EObject object)
Removes an EObject and all reachable objects from this graph. |
boolean |
removeTree(EObject root)
Removes an EObject and all its children from this graph. |
String |
toString()
|
Methods inherited from class java.util.HashSet |
---|
clone, contains, isEmpty, iterator, size |
Methods inherited from class java.util.AbstractSet |
---|
equals, hashCode |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll, retainAll, toArray, toArray |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
contains, containsAll, equals, hashCode, isEmpty, iterator, retainAll, size, toArray, toArray |
Methods inherited from interface java.util.Set |
---|
contains, containsAll, equals, hashCode, isEmpty, iterator, retainAll, size, toArray, toArray |
Field Detail |
---|
protected final Set<EPackage> packages
protected final Map<EClass,List<EObject>> domainMap
protected final Map<EClass,Set<EClass>> inheritanceMap
protected final ECrossReferenceAdapter crossReferenceAdapter
Constructor Detail |
---|
public EGraphImpl()
public EGraphImpl(int initialCapacity)
initialCapacity
- Initial capacity of the graph.public EGraphImpl(EObject object)
object
- An object.public EGraphImpl(Collection<? extends EObject> collection)
collection
- A collection of objects.public EGraphImpl(Resource resource)
resource
- A resource.Method Detail |
---|
protected void initializeContents(Collection<? extends EObject> collection)
collection
- Collection of objects to be added.public final boolean add(EObject object)
add
in interface Collection<EObject>
add
in interface Set<EObject>
add
in class HashSet<EObject>
protected void didAdd(EObject object)
object
- Added object.public final boolean remove(Object object)
remove
in interface Collection<EObject>
remove
in interface Set<EObject>
remove
in class HashSet<EObject>
protected void didRemove(EObject object)
object
- Removed object.public boolean addTree(EObject root)
EGraph
EObject
and all its children to this graph.
addTree
in interface EGraph
root
- The root object of the tree.
true
if an object was added.public boolean removeTree(EObject root)
EGraph
EObject
and all its children from this graph.
removeTree
in interface EGraph
root
- The root object of the tree.
true
if any object was removed.EGraph.addTree(EObject)
public boolean addGraph(EObject object)
EGraph
EObject
and all reachable objects to this graph.
In contrast to EGraph.addTree(EObject)
this method adds all
referenced objects to the graph, and not just the children of
the containment tree.
addGraph
in interface EGraph
object
- An arbitrary object.
true
if at least one object was added.public boolean removeGraph(EObject object)
EGraph
EObject
and all reachable objects from this graph.
removeGraph
in interface EGraph
object
- An arbitrary object.
true
if any object was removed.EGraph.addGraph(EObject)
public boolean addAll(Collection<? extends EObject> objs)
addAll
in interface Collection<EObject>
addAll
in interface Set<EObject>
addAll
in class AbstractCollection<EObject>
public boolean removeAll(Collection<?> objs)
removeAll
in interface Collection<EObject>
removeAll
in interface Set<EObject>
removeAll
in class AbstractSet<EObject>
public void clear()
clear
in interface Collection<EObject>
clear
in interface Set<EObject>
clear
in class HashSet<EObject>
protected boolean addEPackage(EPackage ePackage)
EPackage
. Update the internal inheritance map.
ePackage
- EPackage
to be added.
true
if it is new.protected void addChildParentRelation(EClass child, EClass parent)
child
- Child class.parent
- Parent class.public List<EObject> getDomain(EClass type, boolean strict)
EGraph
EObject
s of this graph which are compatible with the given type.
This returns a fresh and modifiable list.
getDomain
in interface EGraph
type
- The type of the objects.strict
- Whether subtypes are excluded from the result.
EObject
s compatible with the type.public int getDomainSize(EClass type, boolean strict)
EGraph
EGraph.getDomain(EClass, boolean)
.
This method should be used whenever the actual objects are not needed.
getDomainSize
in interface EGraph
type
- The type.strict
- Whether subtypes are excluded.
protected Collection<EObject> getDomain(EClass type)
public ECrossReferenceAdapter getCrossReferenceAdapter()
EGraph
getCrossReferenceAdapter
in interface EGraph
public EGraph copy(Map<EObject,EObject> copies)
EGraph
null
the objects in the graph will be copied too. If the map is not
null
, the images of the map will be used as the new
objects.
copy
in interface EGraph
copies
- Map associating object of this graph to copies. Can be null
.
EGraph
.public List<EObject> getRoots()
EGraph
getRoots
in interface EGraph
public String toString()
toString
in class AbstractCollection<EObject>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |