* @see ActivityPath
*/
protected static ActivityPath findPath(Activity activity) {
EList<ActivityNode> nodes = activity.getOwnedNodes();
ActivityNode currentNode = null;
ActivityPath path = new ActivityPath();
out("there are " + nodes.size() //$NON-NLS-1$
+ " Nodes in the activity"); //$NON-NLS-1$
try {
// find an initial Node in the activity
for (ActivityNode n : nodes) {
if (n instanceof InitialNode) {
currentNode = (InitialNode) n;
path.setStartNode((InitialNode) n);
}
break;
}
// initial node found?
if (currentNode == null) {
err(Messages.getString("Error.INITIAL_NODE_NOT_FOUND")); //$NON-NLS-1$
System.exit(-1);
}
// print Path
out("A valid path through the activity is:");
do {
// node and its linked constraints
out("Node: " + currentNode.getLabel()); //$NON-NLS-1$
if (constraintMap.get(currentNode) != null) {
for (Constraint c : constraintMap.get(currentNode)) {
out(c.toString());
for (EObject o : c.getOwnedElements()) {
out("\t" + o); //$NON-NLS-1$
String expression = new String();
for (String s : ((OpaqueExpression) o).getBodies()) {
expression = expression.concat(s);
}
out(expression);
}
}
}
// edge and its guard conditions
for (ActivityEdge edge : currentNode.getOutgoings()) {
if (edge instanceof ControlFlow) {
path.add((ControlFlow) edge);
out("Edge: " + edge.getName()); //$NON-NLS-1$
for (EObject e : edge.eContents()) {
out(e.toString());
String expression = new String();
for (String s : ((OpaqueExpression) e).getBodies()) {