From 0ec8481c10cd8277d84c7c1a785483a0a739e5a0 Mon Sep 17 00:00:00 2001 From: abranson Date: Thu, 4 Aug 2011 00:42:34 +0200 Subject: More code cleanup: Refactored Entity Proxy Subscription to handle generics better Rewrote RemoteMap to use TreeMap instead of the internal array for order. It now sorts its keys by number if they parse, else as strings. Removed a no-longer-in-progress outcome form class --- .../lifecycle/instance/CompositeActivity.java | 77 ++++++++++++---------- 1 file changed, 43 insertions(+), 34 deletions(-) (limited to 'source/com/c2kernel/lifecycle/instance/CompositeActivity.java') diff --git a/source/com/c2kernel/lifecycle/instance/CompositeActivity.java b/source/com/c2kernel/lifecycle/instance/CompositeActivity.java index 797a5db..c080a37 100644 --- a/source/com/c2kernel/lifecycle/instance/CompositeActivity.java +++ b/source/com/c2kernel/lifecycle/instance/CompositeActivity.java @@ -49,7 +49,8 @@ public class CompositeActivity extends Activity * Functions--------------- -------------------------------------------- */ /** launch the verification of the subprocess() */ - public boolean verify() + @Override + public boolean verify() { boolean err = super.verify(); GraphableVertex[] vChildren = getChildren(); @@ -66,14 +67,14 @@ public class CompositeActivity extends Activity /** * Method initChild. - * + * * @param act * @param first * @param point */ /** * Create an initialize a Activity attached to the current activity - * + * * @param first : * if true, the activity Waiting will be one of the first * launched by the parent activity @@ -90,7 +91,7 @@ public class CompositeActivity extends Activity /** * Method newChild. - * + * * @param Name * @param Type * @param point @@ -105,7 +106,7 @@ public class CompositeActivity extends Activity /** * Method newChild. - * + * * @param Name * @param Type * @param point @@ -120,7 +121,7 @@ public class CompositeActivity extends Activity /** * Method newChild. - * + * * @param vertexTypeId * @param point * @return WfVertex @@ -161,7 +162,7 @@ public class CompositeActivity extends Activity /** * Method newCompChild. - * + * * @param id * @param first * @param point @@ -178,13 +179,13 @@ public class CompositeActivity extends Activity /** * Method newAtomChild. - * + * * @param id * @param first * @param point * @return Activity Create an initialize an Atomic Activity attached to the * current activity - * + * */ public Activity newAtomChild(String id, boolean first, Point point) { @@ -196,7 +197,7 @@ public class CompositeActivity extends Activity /** * Method newSplitChild. - * + * * @param Type * @param point * @return Split @@ -223,7 +224,7 @@ public class CompositeActivity extends Activity /** * Method newJoinChild. - * + * * @param point * @return Join */ @@ -245,7 +246,7 @@ public class CompositeActivity extends Activity /** * Method search. - * + * * @param ids * @return WfVertex */ @@ -275,17 +276,19 @@ public class CompositeActivity extends Activity /** * @see com.c2kernel.lifecycle.instance.WfVertex#run() */ - public void run(AgentPath agent) throws ScriptingEngineException + @Override + public void run(AgentPath agent) throws ScriptingEngineException { super.run(agent); if (getChildrenGraphModel().getStartVertex() != null && getMachine().getCurrentState() != States.FINISHED && ((Boolean) getProperties().get(StateMachine.AUTOSTART)).booleanValue()) { WfVertex first = (WfVertex) getChildrenGraphModel().getStartVertex(); - ((WfVertex) getChildrenGraphModel().getStartVertex()).run(agent); + first.run(agent); } } - public void runNext(AgentPath agent) throws ScriptingEngineException + @Override + public void runNext(AgentPath agent) throws ScriptingEngineException { if (getMachine().state != States.FINISHED) getMachine().traverse(Transitions.COMPLETE); @@ -296,7 +299,8 @@ public class CompositeActivity extends Activity * @see com.c2kernel.lifecycle.instance.Activity#query(com.c2kernel.common.AgentInfo, * java.lang.String, boolean) */ - public Activity[] query(AgentPath agent, int stateID, boolean filter) + @Override + public Activity[] query(AgentPath agent, int stateID, boolean filter) { Vector steps = new Vector(); Activity[] returnArray = null; @@ -307,7 +311,7 @@ public class CompositeActivity extends Activity } int j = 0; for (int i = 0; i < steps.size(); i++) - j += ((Activity[]) steps.elementAt(i)).length; + j += steps.elementAt(i).length; Activity[] tmp = super.query(agent, stateID, filter); if (tmp.length == 1) { @@ -318,9 +322,9 @@ public class CompositeActivity extends Activity j = 0; for (int i = 0; i < steps.size(); i++) { - Activity[] stepArray = (Activity[]) steps.elementAt(i); - for (int k = 0; k < stepArray.length; k++) - returnArray[j++] = stepArray[k]; + Activity[] stepArray = steps.elementAt(i); + for (Activity element : stepArray) + returnArray[j++] = element; } return returnArray; } @@ -328,7 +332,8 @@ public class CompositeActivity extends Activity /** * @see com.c2kernel.lifecycle.instance.Activity#calculateJobs() */ - public ArrayList calculateJobs(AgentPath agent, boolean recurse) + @Override + public ArrayList calculateJobs(AgentPath agent, boolean recurse) { ArrayList jobs = new ArrayList(); boolean childActive = false; @@ -345,7 +350,8 @@ public class CompositeActivity extends Activity return jobs; } - public ArrayList calculateAllJobs(AgentPath agent, boolean recurse) + @Override + public ArrayList calculateAllJobs(AgentPath agent, boolean recurse) { ArrayList jobs = new ArrayList(); if (recurse) @@ -361,7 +367,7 @@ public class CompositeActivity extends Activity /** * Method addNext. - * + * * @param origin * @param terminus * @return Next @@ -373,7 +379,7 @@ public class CompositeActivity extends Activity /** * Method addNext. - * + * * @param originID * @param terminusID * @return Next @@ -388,7 +394,7 @@ public class CompositeActivity extends Activity /** * Method hasGoodNumberOfActivity. - * + * * @return boolean */ public boolean hasGoodNumberOfActivity() @@ -408,7 +414,8 @@ public class CompositeActivity extends Activity /** * @see com.c2kernel.lifecycle.instance.Activity#getType() */ - public String getType() + @Override + public String getType() { if (getName().equals("domain")) return "domain"; @@ -416,16 +423,18 @@ public class CompositeActivity extends Activity } /** - * + * */ - public void reinit(int idLoop) + @Override + public void reinit(int idLoop) { super.reinit(idLoop); if (getChildrenGraphModel().getStartVertex() != null && getMachine().getCurrentState() != States.FINISHED) ((WfVertex) getChildrenGraphModel().getStartVertex()).reinit(idLoop); } - public void request(AgentPath agent, int transitionID, String requestData) throws AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException + @Override + public void request(AgentPath agent, int transitionID, String requestData) throws AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException { if (getChildrenGraphModel().getStartVertex() != null && getMachine().getCurrentState() != States.FINISHED && transitionID == Transitions.START) try @@ -440,10 +449,10 @@ public class CompositeActivity extends Activity public void refreshJobs() { GraphableVertex[] children = getChildren(); - for (int i = 0; i < children.length; i++) - if (children[i] instanceof CompositeActivity) - ((CompositeActivity) children[i]).refreshJobs(); - else if (children[i] instanceof Activity) - ((Activity) children[i]).pushJobsToAgents(); + for (GraphableVertex element : children) + if (element instanceof CompositeActivity) + ((CompositeActivity) element).refreshJobs(); + else if (element instanceof Activity) + ((Activity) element).pushJobsToAgents(); } } \ No newline at end of file -- cgit v1.2.3