Lines Matching defs:State

22  * Linear or DAG of {@link State}s. StateMachine is by default a linear model, until
23 * {@link #addState(State, State)} is called. Each State has three status:
24 * STATUS_ZERO, STATUS_INVOKED, STATUS_EXECUTED. We allow client to run a State, which will
25 * put State in STATUS_INVOKED. A State will be executed when prior States are executed and
26 * Precondition for this State is true, then the State will be marked as STATUS_EXECUTED.
33 * No request on the State
42 * Somebody wants to run the State and the State was executed.
46 public static class State {
49 private ArrayList<State> mPriorStates;
52 * Run State, Subclass may override.
58 * Returns true if State can run, false otherwise. Subclass may override.
59 * @return True if State can run, false otherwise. Subclass may override.
66 * @return True if the State has been executed.
80 void addPriorState(State state) {
82 mPriorStates = new ArrayList<State>();
102 * @return Status of the State.
115 private final ArrayList<State> mSortedList = new ArrayList<State>();
118 * Add a State to StateMachine, ignore if it is already added.
121 public void addState(State state) {
130 * StateMachine is by default a linear model, until {@link #addState(State, State)} is called.
135 public void addState(State fromState, State toState) {
148 public void runState(State state) {
170 * StateMachine is by default a linear model, until {@link #addState(State, State)} is called.
178 ArrayList<State> L = new ArrayList<State>();
180 ArrayList<State> S = new ArrayList<State>();
181 HashMap<State, ArrayList<State>> edges = new HashMap<State, ArrayList<State>>();
183 State state = mSortedList.get(i);
185 edges.put(state, new ArrayList<State>(state.mPriorStates));
192 // remove a State without incoming Node from S, add to L
193 State state = S.remove(S.size() - 1);
196 for (Iterator<Map.Entry<State, ArrayList<State>>> iterator =
198 Map.Entry<State, ArrayList<State>> entry = iterator.next();
199 ArrayList<State> fromStates = entry.getValue();
203 State toState = entry.getKey();