edu.cmu.sei.aadl.modelsupport.modeltraversal
Class ForAllElement

java.lang.Object
  extended by edu.cmu.sei.aadl.modelsupport.modeltraversal.ForAllElement
Direct Known Subclasses:
AadlProcessingSwitch, SimpleSubclassCounter

public class ForAllElement
extends java.lang.Object

ForAllElement plays the role of an iterator object that supports traversal of AADL models Encapsulates traversal algorithms over models. Each instance of ForAllElement contains a resultList that holds all visited model objects as result of the default action.

Processing of model elements is performed by the process(Element) method, which by default calls suchThat(Element) to evaluate a condition and then action(Element) to perform an action. The default condition is true and the default action is to add the visited Element to a resultList. Subclasses can either override suchThat(edu.cmu.sei.aadl.aadl2.Element) and or action(edu.cmu.sei.aadl.aadl2.Element) to get the desired filtering effects, or they can override process(edu.cmu.sei.aadl.aadl2.Element) directly.

Traversals may append objects to a result list. The default implementation of action(edu.cmu.sei.aadl.aadl2.Element) simply adds the visited object to the list. Many of the traversals return this list as their result. Analysis are not required to do anything with this list, however. This list can also be retreived using getResultList().

For ease of anonymous invocation, traversals specify a preferred or default traversal method at construction time using one of the constants NO_DEFAULT, PROCESS_BOTTOM_UP_COMPONENT_IMPL, PROCESS_POST_ORDER_ALL, PROCESS_PRE_ORDER_ALL, PROCESS_TOP_DOWN_COMPONENT_CLASSIFIER, or PROCESS_TOP_DOWN_COMPONENT_IMPL. This default traversal method is used by the defaultTraversal(Element) and defaultTraversal(List) methods. If no default is explicitly specified, then PROCESS_PRE_ORDER_ALL is used. If the default traversal is NO_DEFAULT, then the default traversal methods will throw an UnsupportedOperationException.

The default traversal can be run over all the declarative models in the workspace using defaultTraversalAllDeclarativeModels(). It can be run over all the instance models in the workspace using defaultTraversalAllInstances().

A traversal can cancel itself by calling cancelTraversal(). The traversal methods routinely invoke notCancelled() to see if the traversal has been cancelled. The end user of the traversal object can determine if the traversal was cancelled by checking cancelled(). The result list is not in a well defined state when the traversal has been cancelled.

Author:
phf

Field Summary
static java.lang.String copyright
           
static int DEFAULT_DEFAULT_TRAVERSAL
          The default setting for the default traversal method.
static int NO_DEFAULT
          Constant indicating that there is no default traversal method.
static int PROCESS_BOTTOM_UP_COMPONENT_IMPL
          Constant indicating the default traversal method is #processBottomUpComponentImpl(ComponentImpl).
static int PROCESS_POST_ORDER_ALL
          Constant indicating the default traversal method is processPostOrderAll(Element).
static int PROCESS_PRE_ORDER_ALL
          Constant indicating the default traversal method is processPreOrderAll(Element).
static int PROCESS_TOP_DOWN_COMPONENT_CLASSIFIER
          Constant indicating the default traversal method is #processTopDownComponentClassifier(ComponentImpl).
static int PROCESS_TOP_DOWN_COMPONENT_IMPL
          Constant indicating the default traversal method is #processTopDownComponentImpl(ComponentImpl).
protected  org.eclipse.emf.common.util.EList<Element> resultList
          This list is returned as the result value of the various traversal methods.
 
Constructor Summary
ForAllElement()
          Create a new traversal that uses the null error mananger the default default traversal algorithm.
ForAllElement(AnalysisErrorReporterManager errMgr)
          Create a new traversal that uses the given error manager and uses the default default traversal algorithm.
ForAllElement(int defTraversal)
          Create a new traversal that uses the null error mananger and the given default traversal algorithm.
ForAllElement(int defTraversal, AnalysisErrorReporterManager errMgr)
          Create a new traversal that uses the given error manager and uses the given default traversal algorithm.
 
Method Summary
protected  void action(Element obj)
          Action to be performed on the currently visited model object.
 boolean cancelled()
          Test if we are cancelled.
protected  void cancelTraversal()
          Mark that the traversal should be cancelled.
 org.eclipse.emf.common.util.EList<Element> defaultTraversal(Element obj)
          Execute the default traversal algorithm using the given root object.
 org.eclipse.emf.common.util.EList<Element> defaultTraversal(java.util.List<? extends Element> objs)
          Execute the default traversal algorithm using the given list of root objects.
 org.eclipse.emf.common.util.EList defaultTraversalAllDeclarativeModels()
          Perform the default traversal on all the declarative models in the workspace.
 org.eclipse.emf.common.util.EList defaultTraversalAllInstances()
          Perform the default traversal on all the instance models in the workspace.
 void error(Element obj, java.lang.String msg)
          Report an error on an Element (AADL object model object) using the error reporter associated with that object's Resource.
 void error(Element obj, java.lang.String msg, java.lang.String[] attrs, java.lang.Object[] values)
           
 AnalysisErrorReporterManager getErrorManager()
          Get the analysis error reporter manager associated with this traversal.
 org.eclipse.emf.common.util.EList<Element> getResultList()
          Get the result list of the traversal.
 void info(Element obj, java.lang.String msg)
          Report an information message on an Element (AADL object model object) using the error reporter associated with that object's Resource.
 void info(Element obj, java.lang.String msg, java.lang.String[] attrs, java.lang.Object[] values)
           
 void internalError(java.lang.Exception e)
          Report an internal error.
 void internalError(java.lang.String message)
          Report an internal error.
 boolean notCancelled()
          Test if we weren't cancelled.
protected  void process(Element theElement)
          Process a single model object.
 org.eclipse.emf.common.util.EList processAllComponentImpl()
          Visits all component implementations in the workspace.
 org.eclipse.emf.common.util.EList<?> processBottomUpComponentImpl()
          Visits all the component implementations in the workspace in reverse containment order.
 org.eclipse.emf.common.util.EList processBottomUpComponentImpl(ComponentImplementation root)
          Visits all the component implementations in the subtree rooted at the given node in reverse containment order.
 org.eclipse.emf.common.util.EList<Element> processEList(org.eclipse.emf.common.util.EList<? extends Element> list)
          Processes a list of Elements by invoking process(Element) on every element of the list in order.
 void processObject(Element theElement)
          Process a single model object.
 org.eclipse.emf.common.util.EList processPostOrderAll()
          Process all AADL models in the AadlWorkspace in postfix order.
 org.eclipse.emf.common.util.EList<Element> processPostOrderAll(Element obj)
          Does postorder processing of the model starting at the given node.
 org.eclipse.emf.common.util.EList processPostOrderAll(org.eclipse.emf.common.util.EList objlist)
          Does postorder processing of the model starting at the given root nodes.
 org.eclipse.emf.common.util.EList processPostOrderAllDeclarativeModels()
          Process all declarative AADL models in the AadlWorkspace in postfix order.
 org.eclipse.emf.common.util.EList processPostOrderAllInstances()
          Process all AADL instance models in the AadlWorkspace in postfix order.
 org.eclipse.emf.common.util.EList<Element> processPostOrderComponentInstance(ComponentInstance obj)
          Visits all the ComponentInstance objects in the given instance model in post fix order.
 org.eclipse.emf.common.util.EList<Element> processPostOrderComponentInstance(ComponentInstance obj, ComponentCategory cat)
          Visits all the ComponentInstance objects that are of the given component category (e.g., system, data, thread, etc.) in the given instance model in post fix order.
 org.eclipse.emf.common.util.EList processPreOrderAll()
          Process all AADL models in the AadlWorkspace in in prefix order.
 org.eclipse.emf.common.util.EList<Element> processPreOrderAll(Element obj)
          Does preorder processing of the model starting at the given node.
 org.eclipse.emf.common.util.EList processPreOrderAll(org.eclipse.emf.common.util.EList objlist)
          Does preorder processing of the model starting at the given root nodes.
 org.eclipse.emf.common.util.EList processPreOrderAllDeclarativeModels()
          Process all declarative AADL models in the AadlWorkspace in prefix order.
 org.eclipse.emf.common.util.EList processPreOrderAllInstances()
          Process all AADL instance models in the AadlWorkspace in prefix order.
 org.eclipse.emf.common.util.EList<Element> processPreOrderComponentInstance(ComponentInstance obj)
          Visits all the ComponentInstance objects in the given instance model in prefix order.
 org.eclipse.emf.common.util.EList<Element> processPreOrderComponentInstance(ComponentInstance obj, ComponentCategory cat)
          Visits all the ComponentInstance objects of the given category in the given instance model in prefix order.
static java.util.Set<org.eclipse.emf.ecore.resource.Resource> processResources(java.util.Set<? extends org.eclipse.emf.ecore.resource.Resource> inputResourceSet, ForAllElement[] switches, java.util.Set<? super org.eclipse.emf.ecore.resource.Resource> outputBad)
          Run a series of traversals over a set of resources, recording those that passed and those that failed.
 java.util.Set<org.eclipse.emf.ecore.resource.Resource> processResources(java.util.Set<? extends org.eclipse.emf.ecore.resource.Resource> inputResourceSet, java.util.Set<? super org.eclipse.emf.ecore.resource.Resource> outputBad)
          Run the default traversal over a set of resources, recording those that passed and those that failed.
static java.util.Set<org.eclipse.emf.ecore.resource.Resource> processResourcesIgnoreFailure(java.util.Set<? extends org.eclipse.emf.ecore.resource.Resource> inputResourceSet, ForAllElement[] switches, java.util.Set<? super org.eclipse.emf.ecore.resource.Resource> outputBad)
          Run a series of traversals over a set of resources, recording those that passed and those that failed.
 org.eclipse.emf.common.util.EList<Element> processTopDownComponentClassifier(ComponentImplementation root)
          Visits all the Component Classifiers used in subtree rooted at the given node in a prefix order.
 org.eclipse.emf.common.util.EList processTopDownComponentClassifierAllDeclarativeModels()
          Process all declarative AADL models in the AadlWorkspace according to the top-down component-classifier ordering; see #processTopDownComponentClassifier(ComponentImpl) for more information.
 org.eclipse.emf.common.util.EList processTopDownComponentImpl()
          Process all declarative AADL models in the AadlWorkspace according to the top-down component implementation ordering; see #processTopDownComponentImpl(ComponentImpl) for more information.
 org.eclipse.emf.common.util.EList processTopDownComponentImpl(ComponentImplementation root)
          Visits all the Component Implementations used in the subtree rooted at the given node in a prefix order.
static int processTree(Element root, ForAllElement[] switches)
          Run a series of traversals over a tree rooted at a given Element.
static void processTreeIgnoreFailure(Element root, ForAllElement[] switches)
          Run a series of traversals over a tree rooted at a given Element.
protected  boolean suchThat(Element obj)
          Method used to filter out objects during traversal.
 void warning(Element obj, java.lang.String msg)
          Report a warning on an Element (AADL object model object) using the error reporter associated with that object's Resource.
 void warning(Element obj, java.lang.String msg, java.lang.String[] attrs, java.lang.Object[] values)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static final java.lang.String copyright
See Also:
Constant Field Values

NO_DEFAULT

public static final int NO_DEFAULT
Constant indicating that there is no default traversal method. Attemps to use the default traversal method via defaultTraversal(Element), defaultTraversal(List), etc. will fail with an UnsupportedOperationException.

See Also:
Constant Field Values

PROCESS_BOTTOM_UP_COMPONENT_IMPL

public static final int PROCESS_BOTTOM_UP_COMPONENT_IMPL
Constant indicating the default traversal method is #processBottomUpComponentImpl(ComponentImpl).

See Also:
Constant Field Values

PROCESS_POST_ORDER_ALL

public static final int PROCESS_POST_ORDER_ALL
Constant indicating the default traversal method is processPostOrderAll(Element).

See Also:
Constant Field Values

PROCESS_PRE_ORDER_ALL

public static final int PROCESS_PRE_ORDER_ALL
Constant indicating the default traversal method is processPreOrderAll(Element).

See Also:
Constant Field Values

PROCESS_TOP_DOWN_COMPONENT_CLASSIFIER

public static final int PROCESS_TOP_DOWN_COMPONENT_CLASSIFIER
Constant indicating the default traversal method is #processTopDownComponentClassifier(ComponentImpl).

See Also:
Constant Field Values

PROCESS_TOP_DOWN_COMPONENT_IMPL

public static final int PROCESS_TOP_DOWN_COMPONENT_IMPL
Constant indicating the default traversal method is #processTopDownComponentImpl(ComponentImpl).

See Also:
Constant Field Values

DEFAULT_DEFAULT_TRAVERSAL

public static final int DEFAULT_DEFAULT_TRAVERSAL
The default setting for the default traversal method. The current value for this is PROCESS_PRE_ORDER_ALL.

See Also:
Constant Field Values

resultList

protected final org.eclipse.emf.common.util.EList<Element> resultList
This list is returned as the result value of the various traversal methods. An implementation may or may not use it. The default implementation of action(Element) adds the visited model object to the list.

Constructor Detail

ForAllElement

public ForAllElement(int defTraversal,
                     AnalysisErrorReporterManager errMgr)
Create a new traversal that uses the given error manager and uses the given default traversal algorithm.

Parameters:
defTraversal - The default traversal algorithm. One of NO_DEFAULT, PROCESS_BOTTOM_UP_COMPONENT_IMPL , PROCESS_POST_ORDER_ALL, PROCESS_PRE_ORDER_ALL, PROCESS_TOP_DOWN_COMPONENT_CLASSIFIER, or PROCESS_TOP_DOWN_COMPONENT_IMPL.
errMgr - The analysis error manager to use to report error results.

ForAllElement

public ForAllElement(int defTraversal)
Create a new traversal that uses the null error mananger and the given default traversal algorithm.

Parameters:
defTraversal - The default traversal algorithm. One of NO_DEFAULT, PROCESS_BOTTOM_UP_COMPONENT_IMPL , PROCESS_POST_ORDER_ALL, PROCESS_PRE_ORDER_ALL, PROCESS_TOP_DOWN_COMPONENT_CLASSIFIER, or PROCESS_TOP_DOWN_COMPONENT_IMPL.

ForAllElement

public ForAllElement(AnalysisErrorReporterManager errMgr)
Create a new traversal that uses the given error manager and uses the default default traversal algorithm.

Parameters:
errMgr - The analysis error manager to use to report error results.

ForAllElement

public ForAllElement()
Create a new traversal that uses the null error mananger the default default traversal algorithm.

Method Detail

process

protected void process(Element theElement)
Process a single model object. This method is invoked on each model object by the traversal methods (e.g., processEList(EList), processPreOrderAll(Element), etc.). The default implementation is
 protected void process(Element theElement) {
        if (suchThat(theElement)) {
                action(theElement);
        }
 }
 

But subclasses can reimplement this method to do anything.

See Also:
action(Element), suchThat(Element)

processObject

public final void processObject(Element theElement)
Process a single model object. Delegates to process(Element). This method exists to satisfy the IProcessingMethod interface. I would have preferred to have a process method in the interface, but I cannot because the ForAllElement.process method is protected. If I put the method in an interface, I would have to make the method public, which could break existing code.

Parameters:
theElement - The element to process.

processEList

public final org.eclipse.emf.common.util.EList<Element> processEList(org.eclipse.emf.common.util.EList<? extends Element> list)
Processes a list of Elements by invoking process(Element) on every element of the list in order. The default implementations of process(Element), suchThat(edu.cmu.sei.aadl.aadl2.Element), and action(edu.cmu.sei.aadl.aadl2.Element) mean that by default this method just returns the input list of elements. It can be used to filter out elements by overriding suchThat(Element).

This method checks notCancelled() after each element in the list, and terminates the processing if the traversal has been cancelled.

Parameters:
list - EList of Elements
Returns:
EList result list of objects that have been visited by any traversal with the given ForAllElement
See Also:
process(Element), cancelTraversal(), notCancelled()

suchThat

protected boolean suchThat(Element obj)
Method used to filter out objects during traversal. Intended to be overridden. Used by the default implementation of process(Element):
 protected void process(Element theElement) {
        if (suchThat(theElement)) {
                action(theElement);
        }
 }
 

By default, this method returns true.

Parameters:
obj - The object to test
Returns:
Whether the object should be visited or not.
See Also:
process(Element), action(Element)

action

protected void action(Element obj)
Action to be performed on the currently visited model object. This method is intended to be overridden. This method is used by the default implementation of process(Element):
 protected void process(Element theElement) {
        if (suchThat(theElement)) {
                action(theElement);
        }
 }
 

By default, this method adds the object to resultList. But this method can do anything.

Parameters:
obj - The object to visit.
See Also:
suchThat(Element), process(Element)

getResultList

public org.eclipse.emf.common.util.EList<Element> getResultList()
Get the result list of the traversal. By default, this is the list of the all visited nodes, in the order they were visited. But the actual contents of this list depend on the implementation of process(Element).


cancelTraversal

protected final void cancelTraversal()
Mark that the traversal should be cancelled. This should be called by a specific traversal implementation to halt the traversal. It is not public because there is no sense in outsiders calling this method.

See Also:
cancelled(), notCancelled()

cancelled

public final boolean cancelled()
Test if we are cancelled. Unlike cancelTraversal(), this method is public: it is interesting for the user of the traversal to learn if the traversal was cancelled.

See Also:
notCancelled

notCancelled

public final boolean notCancelled()
Test if we weren't cancelled. Unlike cancelTraversal(), this method is public: it is interesting for the user of the traversal to learn if the traversal was cancelled.

Most the time it is more interesting to know that the traversal wasn't cancelled, than to know that it was cancelled.

See Also:
cancelled()

defaultTraversal

public final org.eclipse.emf.common.util.EList<Element> defaultTraversal(Element obj)
Execute the default traversal algorithm using the given root object. In case of instance models, takes into account the current mode when traversing the content hierarchy of model instances.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Parameters:
obj - The root object to start the traversal.
Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

defaultTraversal

public final org.eclipse.emf.common.util.EList<Element> defaultTraversal(java.util.List<? extends Element> objs)
Execute the default traversal algorithm using the given list of root objects. The traversal is run on each root node in the order they appear in the list. In case of instance models, takes into account the current mode when traversing the content hierarchy of model instances.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Parameters:
objs - List of root objects.
Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
defaultTraversalMethod, cancelTraversal(), notCancelled(), process(Element)

defaultTraversalAllDeclarativeModels

public final org.eclipse.emf.common.util.EList defaultTraversalAllDeclarativeModels()
Perform the default traversal on all the declarative models in the workspace.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
defaultTraversalMethod, cancelTraversal(), notCancelled(), process(Element)

defaultTraversalAllInstances

public final org.eclipse.emf.common.util.EList defaultTraversalAllInstances()
Perform the default traversal on all the instance models in the workspace. Not all traversal algorithsm support this operation: If the specified default traversal is PROCESS_BOTTOM_UP_COMPONENT_IMPL, PROCESS_TOP_DOWN_COMPONENT_CLASSIFIER, or PROCESS_TOP_DOWN_COMPONENT_IMPL then this will throw an UnsupportedOperationException.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
defaultTraversalMethod, cancelTraversal(), notCancelled(), process(Element)

processPreOrderAll

public final org.eclipse.emf.common.util.EList<Element> processPreOrderAll(Element obj)
Does preorder processing of the model starting at the given node. In case of instance models, takes into account the current mode when traversing the content hierarchy of model instances.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Parameters:
obj - The root object of the traversal.
Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processPreOrderAll

public final org.eclipse.emf.common.util.EList processPreOrderAll(org.eclipse.emf.common.util.EList objlist)
Does preorder processing of the model starting at the given root nodes. The subtree rooted at each node in the list is visited in its entirety before the next root node is visited. In case of instance models, takes into account the current mode when traversing the content hierarchy of model instances.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Parameters:
objlist - The roots nodes to be visited.
Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processPreOrderAll

public final org.eclipse.emf.common.util.EList processPreOrderAll()
Process all AADL models in the AadlWorkspace in in prefix order. In case of instance models, takes into account the current mode when traversing the content hierarchy of model instances.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processPreOrderAllDeclarativeModels

public final org.eclipse.emf.common.util.EList processPreOrderAllDeclarativeModels()
Process all declarative AADL models in the AadlWorkspace in prefix order.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processPreOrderAllInstances

public final org.eclipse.emf.common.util.EList processPreOrderAllInstances()
Process all AADL instance models in the AadlWorkspace in prefix order. In case of instance models, takes into account the current mode when traversing the content hierarchy of model instances.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processPreOrderComponentInstance

public final org.eclipse.emf.common.util.EList<Element> processPreOrderComponentInstance(ComponentInstance obj)
Visits all the ComponentInstance objects in the given instance model in prefix order. Takes into account the current mode when traversing the content hierarchy of model instances.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Parameters:
obj - The root object for the traversal.
Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processPreOrderComponentInstance

public final org.eclipse.emf.common.util.EList<Element> processPreOrderComponentInstance(ComponentInstance obj,
                                                                                         ComponentCategory cat)
Visits all the ComponentInstance objects of the given category in the given instance model in prefix order. Takes into account the current mode when traversing the content hierarchy of model instances.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Parameters:
obj - The root object for the traversal.
cat - The category of the component instances to visit.
Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processPostOrderAll

public final org.eclipse.emf.common.util.EList<Element> processPostOrderAll(Element obj)
Does postorder processing of the model starting at the given node. In case of instance models, takes into account the current mode when traversing the content hierarchy of model instances.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Parameters:
obj - The root object of the traversal.
Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processPostOrderAll

public final org.eclipse.emf.common.util.EList processPostOrderAll(org.eclipse.emf.common.util.EList objlist)
Does postorder processing of the model starting at the given root nodes. The subtree rooted at each node in the list is visited in its entirety before the next root node is visited. In case of instance models, takes into account the current mode when traversing the content hierarchy of model instances.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Parameters:
objlist - The roots nodes to be visited.
Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processPostOrderAll

public final org.eclipse.emf.common.util.EList processPostOrderAll()
Process all AADL models in the AadlWorkspace in postfix order. In case of instance models, takes into account the current mode when traversing the content hierarchy of model instances.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processPostOrderAllDeclarativeModels

public final org.eclipse.emf.common.util.EList processPostOrderAllDeclarativeModels()
Process all declarative AADL models in the AadlWorkspace in postfix order.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processPostOrderAllInstances

public final org.eclipse.emf.common.util.EList processPostOrderAllInstances()
Process all AADL instance models in the AadlWorkspace in postfix order. Takes into account the current mode when traversing the content hierarchy of model instances.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processPostOrderComponentInstance

public final org.eclipse.emf.common.util.EList<Element> processPostOrderComponentInstance(ComponentInstance obj)
Visits all the ComponentInstance objects in the given instance model in post fix order. Takes into account the current mode when traversing the content hierarchy of model instances.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Parameters:
obj - The root object for the traversal.
Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processPostOrderComponentInstance

public final org.eclipse.emf.common.util.EList<Element> processPostOrderComponentInstance(ComponentInstance obj,
                                                                                          ComponentCategory cat)
Visits all the ComponentInstance objects that are of the given component category (e.g., system, data, thread, etc.) in the given instance model in post fix order. Takes into account the current mode when traversing the content hierarchy of model instances.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Parameters:
obj - The root object for the traversal.
cat - The category.
Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processTopDownComponentClassifier

public final org.eclipse.emf.common.util.EList<Element> processTopDownComponentClassifier(ComponentImplementation root)
Visits all the Component Classifiers used in subtree rooted at the given node in a prefix order. That is, given a component implementation, it
  1. visits the component implementation
  2. visits the component type
  3. For each subcomponent (including subprogram subcomponents)
    • recursively visits the component implementation of the subcomponent, if the full component implementation is given.
    • visits the component type of the subcomponent, if given

A particular classifier may be visited more than once.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Parameters:
root - The root node.
Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processTopDownComponentClassifierAllDeclarativeModels

public final org.eclipse.emf.common.util.EList processTopDownComponentClassifierAllDeclarativeModels()
Process all declarative AADL models in the AadlWorkspace according to the top-down component-classifier ordering; see #processTopDownComponentClassifier(ComponentImpl) for more information.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processTopDownComponentImpl

public final org.eclipse.emf.common.util.EList processTopDownComponentImpl(ComponentImplementation root)
Visits all the Component Implementations used in the subtree rooted at the given node in a prefix order. That is, given a component implementation, it
  1. visits the component implementation
  2. For each subcomponent (including subprogram subcomponents) it recursively visits the component implementation of the subcomponent, if the full component implementation is given.

A particular classifier may be visited more than once.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Parameters:
root - The root node.
Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processTopDownComponentImpl

public final org.eclipse.emf.common.util.EList processTopDownComponentImpl()
Process all declarative AADL models in the AadlWorkspace according to the top-down component implementation ordering; see #processTopDownComponentImpl(ComponentImpl) for more information.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processBottomUpComponentImpl

public final org.eclipse.emf.common.util.EList processBottomUpComponentImpl(ComponentImplementation root)
Visits all the component implementations in the subtree rooted at the given node in reverse containment order. That is, a component implementation is visited before all the component implementations that reference it.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processBottomUpComponentImpl

public final org.eclipse.emf.common.util.EList<?> processBottomUpComponentImpl()
Visits all the component implementations in the workspace in reverse containment order. That is, a component implementation is visited before all the component implementations that reference it.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processAllComponentImpl

public final org.eclipse.emf.common.util.EList processAllComponentImpl()
Visits all component implementations in the workspace.

This method checks notCancelled() after visiting each element, and terminates the processing if the traversal has been cancelled.

Returns:
The value of resultList. The contents of this list depend on the implementation of process(edu.cmu.sei.aadl.aadl2.Element)/action(edu.cmu.sei.aadl.aadl2.Element).
See Also:
cancelTraversal(), notCancelled(), process(Element)

processResources

public static java.util.Set<org.eclipse.emf.ecore.resource.Resource> processResources(java.util.Set<? extends org.eclipse.emf.ecore.resource.Resource> inputResourceSet,
                                                                                      ForAllElement[] switches,
                                                                                      java.util.Set<? super org.eclipse.emf.ecore.resource.Resource> outputBad)
Run a series of traversals over a set of resources, recording those that passed and those that failed. Each traversal is run over the all the resources before the next analysis is run. Only those resources that pass analysis j are analyzed by analysis j+1. Pass/fail is determined by whether the the number of errors on the resource increased after an analysis was run. Errors are determined by checking the error count (via edu.cmu.sei.aadl.model.pluginsupport.ErrorReporter#getNumErrors() ) on the error reporter associated with each Resource. The union of the returned set with the elements added to outputBad equals inputResourceSet.

Parameters:
inputResourceSet - Set of resources to analyse. The analysis is run on each resource in turn. The resources are assumed to be AADL Object models, that is the Resource.getContents() returns a one-element list whose element is an edu.cmu.sei.aadl.model.core.AadlSpec object.
switches - The analyses to run, as an array of length >= 1. Each analysis is invoked using its default traversal
outputBad - Set that is modified by the method to include all elements of inputResourceSet that fail the series analyses.
Returns:
An unmodifiable set of those elements of inputResourceSet that pass all the analyses.

processResourcesIgnoreFailure

public static java.util.Set<org.eclipse.emf.ecore.resource.Resource> processResourcesIgnoreFailure(java.util.Set<? extends org.eclipse.emf.ecore.resource.Resource> inputResourceSet,
                                                                                                   ForAllElement[] switches,
                                                                                                   java.util.Set<? super org.eclipse.emf.ecore.resource.Resource> outputBad)
Run a series of traversals over a set of resources, recording those that passed and those that failed. Each traversal is run over the all the resources before the next analysis is run. This method differs from processResources(Set, ForAllElement[], Set) in that all the traversals are run over all the resources regardless of whether a previous traversal failed. Errors are determined by checking the error count (via edu.cmu.sei.aadl.model.pluginsupport.ErrorReporter#getNumErrors() ) on the error reporter associated with each Resource. The union of the returned set with the elements added to outputBad equals inputResourceSet.

Parameters:
inputResourceSet - Set of resources to analyse. The analysis is run on each resource in turn. The resources are assumed to be AADL Object models, that is the Resource.getContents() returns a one-element list whose element is an edu.cmu.sei.aadl.model.core.AadlSpec object.
switches - The analyses to run, as an array of length >= 1. Each analysis is invoked using its default traversal
outputBad - Set that is modified by the method to include all elements of inputResourceSet that fail the series analyses.
Returns:
An unmodifiable set of those elements of inputResourceSet that pass all the analyses.

processResources

public final java.util.Set<org.eclipse.emf.ecore.resource.Resource> processResources(java.util.Set<? extends org.eclipse.emf.ecore.resource.Resource> inputResourceSet,
                                                                                     java.util.Set<? super org.eclipse.emf.ecore.resource.Resource> outputBad)
Run the default traversal over a set of resources, recording those that passed and those that failed. Pass/fail is determined by whether the the number of errors on the resource—as determined by error manager associated with the traversal object—increased after the analysis was run. The union of the return value and the elements added to outputBad equals inputResourceSet.

Parameters:
inputResourceSet - Set of resources to analyse. The analysis is run on each resource in turn. The resources are assumed to be AADL Object models, that is the Resource.getContents() returns a one-element list whose element is an edu.cmu.sei.aadl.model.core.AadlSpec object.
outputBad - Set that is modified by the method to include all elements of inputResourceSet that fail the analysis.
Returns:
An unmodifiable set of those elements of inputResourceSet that pass all the analyses.

processTree

public static int processTree(Element root,
                              ForAllElement[] switches)
Run a series of traversals over a tree rooted at a given Element. If a particular traversal fails, i.e., it generates errors in the error reporter, then the subsequent traversals are not performed.

Parameters:
root - The Element that is the root of the tree to traverse.
switches - The analyses to run, as an array of length >= 1. Each analysis is invoked using its default traversal
Returns:
The index of the last traversal to be successfully run. So if all the traversals were successful this value will be switches.length-1. If none of the traversals were successful, this value is -1.

processTreeIgnoreFailure

public static void processTreeIgnoreFailure(Element root,
                                            ForAllElement[] switches)
Run a series of traversals over a tree rooted at a given Element. All traversals are run over the tree regardless of whether a previous traversal failed.

Parameters:
root - The Element that is the root of the tree to traverse.
switches - The analyses to run, as an array of length >= 1. Each analysis is invoked using its default traversal

getErrorManager

public final AnalysisErrorReporterManager getErrorManager()
Get the analysis error reporter manager associated with this traversal.

Returns:
the error manager

internalError

public final void internalError(java.lang.String message)
Report an internal error.

Parameters:
message - The error message.

internalError

public final void internalError(java.lang.Exception e)
Report an internal error.

Parameters:
e - The exception causing the error.

error

public final void error(Element obj,
                        java.lang.String msg)
Report an error on an Element (AADL object model object) using the error reporter associated with that object's Resource.

Parameters:
obj - the object to which the marker is pointing
msg - the message as string

error

public final void error(Element obj,
                        java.lang.String msg,
                        java.lang.String[] attrs,
                        java.lang.Object[] values)

warning

public final void warning(Element obj,
                          java.lang.String msg)
Report a warning on an Element (AADL object model object) using the error reporter associated with that object's Resource.

Parameters:
obj - the object to which the marker is pointing
msg - the message as string

warning

public final void warning(Element obj,
                          java.lang.String msg,
                          java.lang.String[] attrs,
                          java.lang.Object[] values)

info

public final void info(Element obj,
                       java.lang.String msg)
Report an information message on an Element (AADL object model object) using the error reporter associated with that object's Resource.

Parameters:
obj - the object to which the marker is pointing
msg - the message as string

info

public final void info(Element obj,
                       java.lang.String msg,
                       java.lang.String[] attrs,
                       java.lang.Object[] values)