summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/lifecycle/instance/stateMachine
diff options
context:
space:
mode:
authorabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
committerabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
commit0ec8481c10cd8277d84c7c1a785483a0a739e5a0 (patch)
tree5f6e5d9ae75193e67e6f3b3dfa488960c5cde1d5 /source/com/c2kernel/lifecycle/instance/stateMachine
parent036cbdba66f804743c4c838ed598d6972c4b3e17 (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')
-rw-r--r--[-rwxr-xr-x]source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java24
-rw-r--r--[-rwxr-xr-x]source/com/c2kernel/lifecycle/instance/stateMachine/States.java2
-rw-r--r--[-rwxr-xr-x]source/com/c2kernel/lifecycle/instance/stateMachine/Transitions.java4
3 files changed, 15 insertions, 15 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();
}
-
+
}
diff --git a/source/com/c2kernel/lifecycle/instance/stateMachine/States.java b/source/com/c2kernel/lifecycle/instance/stateMachine/States.java
index 638a7b0..b142e35 100755..100644
--- a/source/com/c2kernel/lifecycle/instance/stateMachine/States.java
+++ b/source/com/c2kernel/lifecycle/instance/stateMachine/States.java
@@ -20,7 +20,7 @@ public class States
public final static int RRESERVED = 6;
public final static int RSTARTED = 7;
public final static int RSUSPENDED = 8;
-
+
//everything less that this constant is NOT a repeating state
public final static int REPEATSTATESTART = 5;
diff --git a/source/com/c2kernel/lifecycle/instance/stateMachine/Transitions.java b/source/com/c2kernel/lifecycle/instance/stateMachine/Transitions.java
index 6597686..4239baa 100755..100644
--- a/source/com/c2kernel/lifecycle/instance/stateMachine/Transitions.java
+++ b/source/com/c2kernel/lifecycle/instance/stateMachine/Transitions.java
@@ -26,11 +26,11 @@ public class Transitions
public final static int ACTIVATION = 11;
private static String[] transitions = { "reserve", "start", "skip", "done", "complete", "suspend", "reassign", "resume", "repeat","ignore","proceed","activation" };
-
+
public static String getTransitionName(int trans)
{
try
- {
+ {
return Language.translate(transitions[trans]);
}
catch (ArrayIndexOutOfBoundsException ex)