diff options
| author | abranson <andrew.branson@cern.ch> | 2011-08-04 00:42:34 +0200 |
|---|---|---|
| committer | abranson <andrew.branson@cern.ch> | 2011-08-04 00:42:34 +0200 |
| commit | 0ec8481c10cd8277d84c7c1a785483a0a739e5a0 (patch) | |
| tree | 5f6e5d9ae75193e67e6f3b3dfa488960c5cde1d5 /source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java | |
| parent | 036cbdba66f804743c4c838ed598d6972c4b3e17 (diff) | |
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
Diffstat (limited to 'source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java')
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java b/source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java index da7419c..8159106 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java +++ b/source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java @@ -15,12 +15,12 @@ public class StateMachine implements Serializable {
public int state = 0;
private Activity activity;
-
+
public static final String SKIPPABLE = "Skippable";
public static final String REPEATABLE = "Repeatable";
public static final String IGNORABLE = "Ignorable";
public static final String AUTOSTART = "Autostart";
-
+
/**
* Method StateMachine.
@@ -28,11 +28,11 @@ public class StateMachine implements Serializable */
public StateMachine(Activity act)
{
- activity = act;
+ activity = act;
}
-
+
/** row : States from (WAITING,RESERVED,STARTED,SUSPENDED,FINISHED,RWAITING,RRESERVED,RSTARTED,RSUSPENDED)
- * collumn : transition (RESERVE,START,SKIP,DONE,COMPLETE,SUSPEND,REASIGN,RESUME,REPEAT,IGNORE,PROCEED)
+ * collumn : transition (RESERVE,START,SKIP,DONE,COMPLETE,SUSPEND,REASIGN,RESUME,REPEAT,IGNORE,PROCEED)
* cell : State that is reached (-1 if transition not allowed)
*/
private int[][] getCurrentMachine()
@@ -49,14 +49,14 @@ public class StateMachine implements Serializable /*7 RSTARTED*/ { -1, -1, -1, -1, 4, 8, -1, -1, -1,getIgnorable()?5:-1, -1},/*7 RSTARTED*/
/*8 RSUSPENDED*/ { -1, -1, -1, -1, -1, -1, 8, 7, -1, -1, -1} /*8 RSUSPENDED*/
};
- return returnArray;
+ return returnArray;
}
/**
* @see java.lang.Object#Object()
*/
public StateMachine()
- {
+ {
}
/**
@@ -77,10 +77,10 @@ public class StateMachine implements Serializable int[] trans = new int[9];
int cmpt = 0;
for (int i=0; i< getCurrentMachine()[state].length;i++)
- if (getCurrentMachine()[state][i]!=-1) trans[cmpt++]=i;
-
+ if (getCurrentMachine()[state][i]!=-1) trans[cmpt++]=i;
+
int [] result = new int[cmpt];
- for (int i=0;i<cmpt;i++) result[i] = trans[i];
+ for (int i=0;i<cmpt;i++) result[i] = trans[i];
return result;
}
@@ -93,7 +93,7 @@ public class StateMachine implements Serializable {
int newState = getCurrentMachine()[state][transition];
if (newState > -1) {
- state=newState;
+ state=newState;
return true;
}
Logger.msg("StateMachine.traverse() - Illegal transition "+Transitions.getTransitionName(transition)+" from "+States.getStateName(state));
@@ -138,5 +138,5 @@ public class StateMachine implements Serializable {
return activity.getActive();
}
-
+
}
|
