/** Finishes the current state; call this once you are done adding * transitions for a state. This is automatically called if you * start adding transitions to a new source state, but for the last * state you add you need to this method yourself. */ public void finishState() { if (curState != -1) { finishCurrentState(); curState = -1; } }
/** Add a new transition with the specified source, dest, min, max. */ public void addTransition(int source, int dest, int min, int max) { assert nextTransition%3 == 0; int bounds = nextState/2; FutureObjects.checkIndex(source, bounds); FutureObjects.checkIndex(dest, bounds); growTransitions(); if (curState != source) { if (curState != -1) { finishCurrentState(); } // Move to next source: curState = source; if (states[2*curState] != -1) { throw new IllegalStateException("from state (" + source + ") already had transitions added"); } assert states[2*curState+1] == 0; states[2*curState] = nextTransition; } transitions[nextTransition++] = dest; transitions[nextTransition++] = min; transitions[nextTransition++] = max; // Increment transition count for this state states[2*curState+1]++; }
/** Finishes the current state; call this once you are done adding * transitions for a state. This is automatically called if you * start adding transitions to a new source state, but for the last * state you add you need to this method yourself. */ public void finishState() { if (curState != -1) { finishCurrentState(); curState = -1; } }
/** Finishes the current state; call this once you are done adding * transitions for a state. This is automatically called if you * start adding transitions to a new source state, but for the last * state you add you need to this method yourself. */ public void finishState() { if (curState != -1) { finishCurrentState(); curState = -1; } }
/** Finishes the current state; call this once you are done adding * transitions for a state. This is automatically called if you * start adding transitions to a new source state, but for the last * state you add you need to this method yourself. */ public void finishState() { if (curState != -1) { finishCurrentState(); curState = -1; } }
/** Add a new transition with the specified source, dest, min, max. */ public void addTransition(int source, int dest, int min, int max) { assert nextTransition%3 == 0; if (source >= nextState/2) { throw new IllegalArgumentException("source=" + source + " is out of bounds (maxState is " + (nextState/2-1) + ")"); } if (dest >= nextState/2) { throw new IllegalArgumentException("dest=" + dest + " is out of bounds (max state is " + (nextState/2-1) + ")"); } growTransitions(); if (curState != source) { if (curState != -1) { finishCurrentState(); } // Move to next source: curState = source; if (states[2*curState] != -1) { throw new IllegalStateException("from state (" + source + ") already had transitions added"); } assert states[2*curState+1] == 0; states[2*curState] = nextTransition; } transitions[nextTransition++] = dest; transitions[nextTransition++] = min; transitions[nextTransition++] = max; // Increment transition count for this state states[2*curState+1]++; }
/** Add a new transition with the specified source, dest, min, max. */ public void addTransition(int source, int dest, int min, int max) { assert nextTransition%3 == 0; if (source >= nextState/2) { throw new IllegalArgumentException("source=" + source + " is out of bounds (maxState is " + (nextState/2-1) + ")"); } if (dest >= nextState/2) { throw new IllegalArgumentException("dest=" + dest + " is out of bounds (max state is " + (nextState/2-1) + ")"); } growTransitions(); if (curState != source) { if (curState != -1) { finishCurrentState(); } // Move to next source: curState = source; if (states[2*curState] != -1) { throw new IllegalStateException("from state (" + source + ") already had transitions added"); } assert states[2*curState+1] == 0; states[2*curState] = nextTransition; } transitions[nextTransition++] = dest; transitions[nextTransition++] = min; transitions[nextTransition++] = max; // Increment transition count for this state states[2*curState+1]++; }
/** Add a new transition with the specified source, dest, min, max. */ public void addTransition(int source, int dest, int min, int max) { assert nextTransition%3 == 0; int bounds = nextState/2; FutureObjects.checkIndex(source, bounds); FutureObjects.checkIndex(dest, bounds); growTransitions(); if (curState != source) { if (curState != -1) { finishCurrentState(); } // Move to next source: curState = source; if (states[2*curState] != -1) { throw new IllegalStateException("from state (" + source + ") already had transitions added"); } assert states[2*curState+1] == 0; states[2*curState] = nextTransition; } transitions[nextTransition++] = dest; transitions[nextTransition++] = min; transitions[nextTransition++] = max; // Increment transition count for this state states[2*curState+1]++; }