String DFA::debInfo() const { String s("DFA"); s << " # states=" << numStates(); s << " startState=" << startState() << "\n"; for (int i = 0; i < numStates(); i++) { DFAState &state = getState(i); #if !AUGMENT String work; if (state.flag(DFAState::F_FINAL)) { work << "F"; if (state.finalCode() >= 0) work << state.finalCode(); } work.pad(3); s << work; #else s << (char)(state.flag(DFAState::F_FINAL) ? '*' : ' '); #endif s << (char)(state.flag(DFAState::F_DELETE) ? 'D' : ' '); s << (char)(state.flag(DFAState::F_VISITED) ? 'V' : ' '); s << fmt(i,3) << " "; s << state.transitionInfo(); s << '\n'; } return s; }
// construct a list of all possible symbols void DFA::min_getSymbolSet(OrdSet &symbols) const { Array<int> symList; for (int i = 0; i < numStates(); i++) { DFAState &s = getState(i); s.getSymbols(symList); for (int j = 0; j < symList.length(); j++) symbols.add(symList.itemAt(j)); } }
void DFA::addState(int s) { if (s < 0 || s >= MAX_STATES) throw Exception("Invalid state"); // add new states if necessary between end of state // array and this state while (s >= numStates()) { states_.add(DFAState()); } }
void ChanceNode::evaluate() { pCPT = cpt; // init ptr into the cpt if ( parents.size() ) // is this node dependent? for ( int s=0; s<numStates(); s++ ) if (!state[s]->flags.test(State::READ_ONLY) ) setState( s, recursParent(0) ); else recursParent(0); }
void Faders::next(Cell* current, int index) { int alive, state, nextIndex; nextIndex = wrapi(index + 1, 0, 2); alive = current->countAliveNeighbors(index); state = current->states[index]; if (state > 1) { if (state < numStates()) { current->states[nextIndex] = state + 1; } else { current->states[nextIndex] = 0; } } else { if (state == 0) { current->states[nextIndex] = _births[alive]; } else { if (_survivals[alive] == 0) { if (state < numStates()) { current->states[nextIndex] = state + 1; } else { current->states[nextIndex] = 0; } } else { current->states[nextIndex] = 1; } } } }
int DFA::getTransitionState(int stateI, int symbol) { if (stateI < 0 || stateI >= MAX_STATES) throw Exception("Invalid state"); int stateD = -1; do { if (stateI >= numStates()) break; stateD = getState(stateI).getTransitionState(symbol); } while (false); return stateD; }
double Continuous::mapState(double state) { return unmapf(state, 0.0, numStates() - 1); }
double Life::mapState(double state) { return (float)((int)mapf(state, 0.0, numStates() - 1)); }
void HLL::initBuffers() { Super::initBuffers(); eigenvaluesBuffer = cl.alloc(sizeof(real) * numStates() * getVolume() * app->dim); }