org.eclipse.emf.henshin.statespace.util
Class ResourceNavigator

java.lang.Object
  extended by org.eclipse.emf.henshin.statespace.util.ResourceNavigator

public class ResourceNavigator
extends Object

Helper class for navigating through resource contents. Supports depth-first traversal, skipping of subtrees, and back-tracking.


Constructor Summary
ResourceNavigator(Resource resource, boolean withNonContainment, boolean withDerived)
          Default constructor.
 
Method Summary
 EObject backward()
          Go one step backward.
 EObject forward()
          Follow the first outgoing link in the current target object.
 int getIndex()
          Get the index of the currently selected link.
 EReference getReference()
          Get the reference of the currently selected link.
 EObject getSource()
          Get the source object of the currently selected link.
 EObject getTarget()
          Get the target object of the currently selected link.
 boolean isEnd()
          Returns true is the end was reached.
 boolean isStart()
          Returns true is the start was reached.
 EObject skip()
          Skip the current target and proceed with the rest.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceNavigator

public ResourceNavigator(Resource resource,
                         boolean withNonContainment,
                         boolean withDerived)
Default constructor.

Parameters:
resource - Resource to be traversed.
withNonContainment - Whether we want to traverse non-containment links.
withDerived - Whether we shall include derived features.
Method Detail

getSource

public EObject getSource()
Get the source object of the currently selected link.

Returns:
The source object of the link (can be null).

getTarget

public EObject getTarget()
Get the target object of the currently selected link.

Returns:
The target object of the link (can be null).

getReference

public EReference getReference()
Get the reference of the currently selected link.

Returns:
The current reference.

getIndex

public int getIndex()
Get the index of the currently selected link.

Returns:
The current index.

isStart

public boolean isStart()
Returns true is the start was reached.

Returns:
true if we are at the start.

isEnd

public boolean isEnd()
Returns true is the end was reached.

Returns:
true if we are at the end.

forward

public EObject forward()
Follow the first outgoing link in the current target object. If that is no possible, the method invokes skip() and returns the result of this invocation.

Returns:
The new target object.

skip

public EObject skip()
Skip the current target and proceed with the rest.

Returns:
The new target.

backward

public EObject backward()
Go one step backward.

Returns:
The previous target.