public class TransitiveClosureHelperImpl extends org.eclipse.emf.ecore.util.EContentAdapter implements TransitiveClosureHelper, ITcObserver<org.eclipse.emf.ecore.EObject>, FeatureListener, InstanceListener
TransitiveClosureHelper
.
It uses a NavigationHelper
instance to wrap an EMF model
and make it suitable for the IncSCCAlg
algorithm.Constructor and Description |
---|
TransitiveClosureHelperImpl(NavigationHelper navigationHelper,
boolean disposeBaseIndexWhenDisposed,
java.util.Set<org.eclipse.emf.ecore.EReference> references) |
Modifier and Type | Method and Description |
---|---|
void |
attachObserver(ITcObserver<org.eclipse.emf.ecore.EObject> to)
Attach a transitive closure relation observer.
|
void |
detachObserver(ITcObserver<org.eclipse.emf.ecore.EObject> to)
Detach a transitive closure relation observer.
|
void |
dispose()
Call this method to properly dispose the data structures of a transitive closure algorithm.
|
void |
featureDeleted(org.eclipse.emf.ecore.EObject host,
org.eclipse.emf.ecore.EStructuralFeature feature,
java.lang.Object value)
Called when the given value is removed from the given feature of the given host EObject.
|
void |
featureInserted(org.eclipse.emf.ecore.EObject host,
org.eclipse.emf.ecore.EStructuralFeature feature,
java.lang.Object value)
Called when the given value is inserted into the given feature of the given host EObject.
|
java.util.Set<org.eclipse.emf.ecore.EObject> |
getAllReachableSources(org.eclipse.emf.ecore.EObject target)
Returns all nodes from which the target node is reachable.
|
java.util.Set<org.eclipse.emf.ecore.EObject> |
getAllReachableTargets(org.eclipse.emf.ecore.EObject source)
Returns all nodes which are reachable from the source node.
|
IGraphPathFinder<org.eclipse.emf.ecore.EObject> |
getPathFinder()
The returned
IGraphPathFinder can be used to retrieve paths between nodes using transitive reachability. |
java.util.List<org.eclipse.emf.ecore.EObject> |
getReachabilityPath(org.eclipse.emf.ecore.EObject source,
org.eclipse.emf.ecore.EObject target)
Returns a reachability path between the given source and target elements, or null if no such transitive reachability is present in the graph.
|
void |
instanceDeleted(org.eclipse.emf.ecore.EClass clazz,
org.eclipse.emf.ecore.EObject instance)
Called when the given instance was removed from the model.
|
void |
instanceInserted(org.eclipse.emf.ecore.EClass clazz,
org.eclipse.emf.ecore.EObject instance)
Called when the given instance was added to the model.
|
boolean |
isReachable(org.eclipse.emf.ecore.EObject source,
org.eclipse.emf.ecore.EObject target)
Returns true if the target node is reachable from the source node.
|
void |
tupleDeleted(org.eclipse.emf.ecore.EObject source,
org.eclipse.emf.ecore.EObject target)
Used to notify when a tuple is deleted from the transitive closure relation.
|
void |
tupleInserted(org.eclipse.emf.ecore.EObject source,
org.eclipse.emf.ecore.EObject target)
Used to notify when a tuple is inserted into the transitive closure relation.
|
notifyChanged, setTarget, unsetTarget
public TransitiveClosureHelperImpl(NavigationHelper navigationHelper, boolean disposeBaseIndexWhenDisposed, java.util.Set<org.eclipse.emf.ecore.EReference> references)
public void attachObserver(ITcObserver<org.eclipse.emf.ecore.EObject> to)
ITcDataSource
attachObserver
in interface ITcDataSource<org.eclipse.emf.ecore.EObject>
to
- the observer objectpublic void detachObserver(ITcObserver<org.eclipse.emf.ecore.EObject> to)
ITcDataSource
detachObserver
in interface ITcDataSource<org.eclipse.emf.ecore.EObject>
to
- the observer objectpublic java.util.Set<org.eclipse.emf.ecore.EObject> getAllReachableTargets(org.eclipse.emf.ecore.EObject source)
ITcDataSource
getAllReachableTargets
in interface ITcDataSource<org.eclipse.emf.ecore.EObject>
source
- the source nodepublic java.util.Set<org.eclipse.emf.ecore.EObject> getAllReachableSources(org.eclipse.emf.ecore.EObject target)
ITcDataSource
getAllReachableSources
in interface ITcDataSource<org.eclipse.emf.ecore.EObject>
target
- the target nodepublic boolean isReachable(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target)
ITcDataSource
isReachable
in interface ITcDataSource<org.eclipse.emf.ecore.EObject>
source
- the source nodetarget
- the target nodepublic void tupleInserted(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target)
ITcObserver
tupleInserted
in interface ITcObserver<org.eclipse.emf.ecore.EObject>
source
- the source of the tupletarget
- the target of the tuplepublic void tupleDeleted(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target)
ITcObserver
tupleDeleted
in interface ITcObserver<org.eclipse.emf.ecore.EObject>
source
- the source of the tupletarget
- the target of the tuplepublic void dispose()
ITcDataSource
dispose
in interface ITcDataSource<org.eclipse.emf.ecore.EObject>
public void featureInserted(org.eclipse.emf.ecore.EObject host, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value)
FeatureListener
featureInserted
in interface FeatureListener
host
- the host (holder) of the featurefeature
- the EAttribute
or EReference
instancevalue
- the target of the featurepublic void featureDeleted(org.eclipse.emf.ecore.EObject host, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value)
FeatureListener
featureDeleted
in interface FeatureListener
host
- the host (holder) of the featurefeature
- the EAttribute
or EReference
instancevalue
- the target of the featurepublic void instanceInserted(org.eclipse.emf.ecore.EClass clazz, org.eclipse.emf.ecore.EObject instance)
InstanceListener
instanceInserted
in interface InstanceListener
clazz
- an EClass registered for this listener, for which a new instance (possibly an instance of a subclass) was inserted into the modelinstance
- an EObject instance that was inserted into the modelpublic void instanceDeleted(org.eclipse.emf.ecore.EClass clazz, org.eclipse.emf.ecore.EObject instance)
InstanceListener
instanceDeleted
in interface InstanceListener
clazz
- an EClass registered for this listener, for which an instance (possibly an instance of a subclass) was removed from the modelinstance
- an EObject instance that was removed from the modelpublic java.util.List<org.eclipse.emf.ecore.EObject> getReachabilityPath(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target)
ITcDataSource
List
contains the nodes along the path
(this means that there is an edge in the graph between two consecutive nodes), including the source and target nodes.
A self loop (one edge) is indicated with the source node being present two times in the returned List
.
Note that the paths are not maintained incrementally and in worst case the complexity of the path construction is O(|V|+|E|)
(one depth-first graph traversal). There is no guarantee that the given path is the shortest one between the given two nodes.getReachabilityPath
in interface ITcDataSource<org.eclipse.emf.ecore.EObject>
source
- the source nodetarget
- the target nodepublic IGraphPathFinder<org.eclipse.emf.ecore.EObject> getPathFinder()
ITcDataSource
IGraphPathFinder
can be used to retrieve paths between nodes using transitive reachability.getPathFinder
in interface ITcDataSource<org.eclipse.emf.ecore.EObject>