|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.validation.service.AbstractTraversalStrategy
public abstract class AbstractTraversalStrategy
An iterator-based partial implementation of the ITraversalStrategy
interface. Subclasses need only compute how many elements are covered by the
set of traversal roots, and an iterator that provides them all.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.eclipse.emf.validation.service.ITraversalStrategy |
---|
ITraversalStrategy.Flat, ITraversalStrategy.Recursive |
Constructor Summary | |
---|---|
AbstractTraversalStrategy()
Initializes me. |
Method Summary | |
---|---|
protected abstract int |
countElements(Collection<? extends EObject> traversalRoots)
Implemented by subclasses to compute the number of elements that will be validated within the scope of the specified root elements. |
protected abstract Iterator<? extends EObject> |
createIterator(Collection<? extends EObject> traversalRoots)
Implemented by subclasses to return an iterator that provides all of the elements to be validated, within the scope of the specified root elements. |
void |
elementValidated(EObject element,
IStatus status)
Implements the interface method by advancing the progress monitor by a single work unit. |
protected IProgressMonitor |
getProgressMonitor()
Provides subclasses with access to the progress monitor, if they want it (for example, to set sub-task labels) |
protected String |
getTaskLabel()
Can be redefined by subclasses to provide the task label for the progress monitor. |
boolean |
hasNext()
Just determines whether the subclass-provided iterator has a next element. |
boolean |
isClientContextChanged()
This implementation is pessimistic, always returning true
to indicate that the client context should be recomputed for each
object traversed. |
EObject |
next()
Returns the subclass-provided iterator's next element. |
void |
startTraversal(Collection<? extends EObject> traversalRoots,
IProgressMonitor progressMonitor)
Initializes the traversal by asking the subclass to count the number of elements that will be validated and to create an iterator that will provide them all. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractTraversalStrategy()
Method Detail |
---|
public void startTraversal(Collection<? extends EObject> traversalRoots, IProgressMonitor progressMonitor)
startTraversal
in interface ITraversalStrategy
traversalRoots
- a collection of one or more EObject
s.
It is never empty, but neither is it modifiableprogressMonitor
- the progress monitor used to track progress. The receiver
may retain this progress monitor for the duration of the traversalprotected String getTaskLabel()
protected abstract int countElements(Collection<? extends EObject> traversalRoots)
traversalRoots
- the roots of the traversal sub-trees
protected abstract Iterator<? extends EObject> createIterator(Collection<? extends EObject> traversalRoots)
traversalRoots
- the roots of the traversal sub-trees
protected IProgressMonitor getProgressMonitor()
public boolean hasNext()
hasNext
in interface ITraversalStrategy
true
if another element can be obtained from the
ITraversalStrategy.next()
method; false
, otherwisecreateIterator(java.util.Collection extends org.eclipse.emf.ecore.EObject>)
public EObject next()
next
in interface ITraversalStrategy
createIterator(java.util.Collection extends org.eclipse.emf.ecore.EObject>)
public boolean isClientContextChanged()
true
to indicate that the client context should be recomputed for each
object traversed.
isClientContextChanged
in interface ITraversalStrategy
true
if the next object to be returned by the
ITraversalStrategy.next()
method is potentially in a different client context
than the previous (thereby requiring the validation framework to
recompute the context); false
if the object can be
assumed to be in the same context as the previouspublic void elementValidated(EObject element, IStatus status)
elementValidated
in interface ITraversalStrategy
element
- the element that was validatedstatus
- the element
's validation status, indicating
success or failure of its constraints. The receiver may with use
this information to exclude or include portions of the model based
on the status of the element
|
Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |