org.eclipse.emf.henshin.interpreter
Interface EGraph

All Superinterfaces:
Collection<EObject>, Iterable<EObject>
All Known Subinterfaces:
PartitionedEGraph
All Known Implementing Classes:
EGraphImpl, HenshinEGraph, PartitionedEGraphImpl

public interface EGraph
extends Collection<EObject>

Interface for storing EObject graphs.


Method Summary
 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.
 EGraph copy(Map<EObject,EObject> copies)
          Copy this object graph.
 ECrossReferenceAdapter getCrossReferenceAdapter()
          Get the cross reference adapter of this graph.
 List<EObject> getDomain(EClass type, boolean strict)
          Get all EObjects 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.
 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.
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

addTree

boolean addTree(EObject root)
Adds an EObject and all its children to this graph.

Parameters:
root - The root object of the tree.
Returns:
true if an object was added.

addGraph

boolean addGraph(EObject object)
Adds an EObject and all reachable objects to this graph. In contrast to addTree(EObject) this method adds all referenced objects to the graph, and not just the children of the containment tree.

Parameters:
object - An arbitrary object.
Returns:
true if at least one object was added.

removeTree

boolean removeTree(EObject root)
Removes an EObject and all its children from this graph.

Parameters:
root - The root object of the tree.
Returns:
true if any object was removed.
See Also:
addTree(EObject)

removeGraph

boolean removeGraph(EObject object)
Removes an EObject and all reachable objects from this graph.

Parameters:
object - An arbitrary object.
Returns:
true if any object was removed.
See Also:
addGraph(EObject)

copy

EGraph copy(Map<EObject,EObject> copies)
Copy this object graph. If the parameter map is 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.

Parameters:
copies - Map associating object of this graph to copies. Can be null.
Returns:
The copied version of this EGraph.

getDomain

List<EObject> getDomain(EClass type,
                        boolean strict)
Get all EObjects of this graph which are compatible with the given type. This returns a fresh and modifiable list.

Parameters:
type - The type of the objects.
strict - Whether subtypes are excluded from the result.
Returns:
A set of EObjects compatible with the type.

getDomainSize

int getDomainSize(EClass type,
                  boolean strict)
Returns the size of the domain for a type. The returned number equals the size of the list returned by getDomain(EClass, boolean). This method should be used whenever the actual objects are not needed.

Parameters:
type - The type.
strict - Whether subtypes are excluded.
Returns:
The size of the domain.

getRoots

List<EObject> getRoots()
Get the root objects in this graph. This returns a fresh and modifiable list.

Returns:
The root objects.

getCrossReferenceAdapter

ECrossReferenceAdapter getCrossReferenceAdapter()
Get the cross reference adapter of this graph.

Returns:
The cross reference adapter.