edu.cmu.sei.aadl.model.util
Class ForAllAObject

java.lang.Object
  extended by edu.cmu.sei.aadl.model.util.ForAllAObject
Direct Known Subclasses:
AadlProcessingSwitch, AnnexInstantiationController, AnnexResolverController, ComposedAadlProcessor

public class ForAllAObject
extends java.lang.Object

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

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

Traversals may append objects to a result list. The default implementation of action(edu.cmu.sei.aadl.model.core.AObject) 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(AObject) 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(AObject).
static int PROCESS_PRE_ORDER_ALL
          Constant indicating the default traversal method is processPreOrderAll(AObject).
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 resultList
          This list is returned as the result value of the various traversal methods.
 
Constructor Summary
ForAllAObject()
          Create a new traversal that uses the null error mananger the default default traversal algorithm.
ForAllAObject(AnalysisErrorReporterManager errMgr)
          Create a new traversal that uses the given error manager and uses the default default traversal algorithm.
ForAllAObject(int defTraversal)
          Create a new traversal that uses the null error mananger and the given default traversal algorithm.
ForAllAObject(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(AObject 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 defaultTraversal(AObject obj)
          Execute the default traversal algorithm using the given root object.
 org.eclipse.emf.common.util.EList defaultTraversal(java.util.List 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(AObject obj, java.lang.String msg)
          Report an error on an AObject (AADL object model object) using the error reporter associated with that object's Resource.
 void error(AObject 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 getResultList()
          Get the result list of the traversal.
 void info(AObject obj, java.lang.String msg)
          Report an information message on an AObject (AADL object model object) using the error reporter associated with that object's Resource.
 void info(AObject 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(AObject theAObject)
          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(ComponentImpl root)
          Visits all the component implementations in the subtree rooted at the given node in reverse containment order.
 org.eclipse.emf.common.util.EList processEList(org.eclipse.emf.common.util.EList list)
          Processes a list of AObjects by invoking process(AObject) on every element of the list in order.
 void processObject(AObject theAObject)
          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 processPostOrderAll(AObject 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 processPostOrderComponentInstance(ComponentInstance obj)
          Visits all the ComponentInstance objects in the given instance model in post fix order.
 org.eclipse.emf.common.util.EList 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 processPreOrderAll(AObject 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 processPreOrderComponentInstance(ComponentInstance obj)
          Visits all the ComponentInstance objects in the given instance model in prefix order.
 org.eclipse.emf.common.util.EList 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 processResources(java.util.Set inputResourceSet, ForAllAObject[] switches, java.util.Set outputBad)
          Run a series of traversals over a set of resources, recording those that passed and those that failed.
 java.util.Set processResources(java.util.Set inputResourceSet, java.util.Set outputBad)
          Run the default traversal over a set of resources, recording those that passed and those that failed.
static java.util.Set processResourcesIgnoreFailure(java.util.Set inputResourceSet, ForAllAObject[] switches, java.util.Set 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 processTopDownComponentClassifier(ComponentImpl 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(ComponentImpl root)
          Visits all the Component Implementations used in the subtree rooted at the given node in a prefix order.
static int processTree(AObject root, ForAllAObject[] switches)
          Run a series of traversals over a tree rooted at a given AObject.
static void processTreeIgnoreFailure(AObject root, ForAllAObject[] switches)
          Run a series of traversals over a tree rooted at a given AObject.
protected  boolean suchThat(AObject obj)
          Method used to filter out objects during traversal.
 void warning(AObject obj, java.lang.String msg)
          Report a warning on an AObject (AADL object model object) using the error reporter associated with that object's Resource.
 void warning(AObject 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(AObject), 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(AObject).

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(AObject).

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 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(AObject) adds the visited model object to the list.

Constructor Detail

ForAllAObject

public ForAllAObject(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.

ForAllAObject

public ForAllAObject(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.

ForAllAObject

public ForAllAObject(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.

ForAllAObject

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

Method Detail

process

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

But subclasses can reimplement this method to do anything.

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

processObject

public final void processObject(AObject theAObject)
Process a single model object. Delegates to process(AObject). 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 ForAllAObject.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:
theAObject - The element to process.

processEList

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

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

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

suchThat

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

By default, this method returns true.

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

action

protected void action(AObject 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(AObject):
 protected void process(AObject theAObject) {
        if (suchThat(theAObject)) {
                action(theAObject);
        }
 }
 

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

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

getResultList

public org.eclipse.emf.common.util.EList 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(AObject).


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 defaultTraversal(AObject 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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

defaultTraversal

public final org.eclipse.emf.common.util.EList defaultTraversal(java.util.List 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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
defaultTraversalMethod, cancelTraversal(), notCancelled(), process(AObject)

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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
defaultTraversalMethod, cancelTraversal(), notCancelled(), process(AObject)

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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
defaultTraversalMethod, cancelTraversal(), notCancelled(), process(AObject)

processPreOrderAll

public final org.eclipse.emf.common.util.EList processPreOrderAll(AObject 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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

processPreOrderComponentInstance

public final org.eclipse.emf.common.util.EList 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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

processPreOrderComponentInstance

public final org.eclipse.emf.common.util.EList 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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

processPostOrderAll

public final org.eclipse.emf.common.util.EList processPostOrderAll(AObject 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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

processPostOrderComponentInstance

public final org.eclipse.emf.common.util.EList 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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

processPostOrderComponentInstance

public final org.eclipse.emf.common.util.EList 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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

processTopDownComponentClassifier

public final org.eclipse.emf.common.util.EList processTopDownComponentClassifier(ComponentImpl 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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

processTopDownComponentImpl

public final org.eclipse.emf.common.util.EList processTopDownComponentImpl(ComponentImpl 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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

processBottomUpComponentImpl

public final org.eclipse.emf.common.util.EList processBottomUpComponentImpl(ComponentImpl 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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

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.model.core.AObject)/action(edu.cmu.sei.aadl.model.core.AObject).
See Also:
cancelTraversal(), notCancelled(), process(AObject)

processResources

public static java.util.Set processResources(java.util.Set inputResourceSet,
                                             ForAllAObject[] switches,
                                             java.util.Set 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 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 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 processResourcesIgnoreFailure(java.util.Set inputResourceSet,
                                                          ForAllAObject[] switches,
                                                          java.util.Set 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, ForAllAObject[], 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 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 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 processResources(java.util.Set inputResourceSet,
                                            java.util.Set 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 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(AObject root,
                              ForAllAObject[] switches)
Run a series of traversals over a tree rooted at a given AObject. If a particular traversal fails, i.e., it generates errors in the error reporter, then the subsequent traversals are not performed.

Parameters:
root - The AObject 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(AObject root,
                                            ForAllAObject[] switches)
Run a series of traversals over a tree rooted at a given AObject. All traversals are run over the tree regardless of whether a previous traversal failed.

Parameters:
root - The AObject 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.


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(AObject obj,
                        java.lang.String msg)
Report an error on an AObject (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(AObject obj,
                        java.lang.String msg,
                        java.lang.String[] attrs,
                        java.lang.Object[] values)

warning

public final void warning(AObject obj,
                          java.lang.String msg)
Report a warning on an AObject (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(AObject obj,
                          java.lang.String msg,
                          java.lang.String[] attrs,
                          java.lang.Object[] values)

info

public final void info(AObject obj,
                       java.lang.String msg)
Report an information message on an AObject (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(AObject obj,
                       java.lang.String msg,
                       java.lang.String[] attrs,
                       java.lang.Object[] values)