forceinline void NextSolCursor::moveSidewards(void) { if (back) { alternative(alternative()-1); node(node()->getParent(na)->getChild(na,alternative())); } else { NodeCursor<VisualNode>::moveSidewards(); } }
coDistributedObject *ComputeTrace::computeFloats(float (*alternative)(float, int), const char *objName) { const size_t steps = 1 + m_timestepStop - m_timestepStart; if (p_animate->getValue()) { std::vector<coDistributedObject *> traceFade(steps); coDoFloat *nullFloat = new coDoFloat(createIndexedName(objName, 0), 0, 0); for (int i = m_timestepStart; i < m_start; i++) { if (i > m_timestepStart) nullFloat->incRefCount(); //reuse of nullLine traceFade[i] = nullFloat; } //creating a temporary variable that holds all traces of the traced particles //of one timestep. These objects will be put together in a coDoSet. std::vector<coDistributedObject *> floatSet(m_particleSelection.size()); //successive creation of the traces between start and stop for (size_t i = m_start; i <= m_stop; i++) { for (size_t particle = 0; particle < m_particleSelection.size(); particle++) { floatSet[particle] = new coDoFloat(createIndexedName(objName, i, particle).c_str(), i + 1 - m_start); float *data = ((coDoFloat *)floatSet[particle])->getAddress(); for (size_t j = 0; j < i + 1 - m_start; j++) { data[j] = alternative(particle / (float)m_particleSelection.size(), (i - m_start - j)); } } //creating the line object set for the current timestep traceFade[i] = new coDoSet(createIndexedName(objName, i).c_str(), floatSet.size(), &floatSet[0]); } //last drawn line will be visible for every timestep after stop for (int i = m_stop + 1; i <= m_timestepStop; i++) { traceFade[i] = traceFade[i - 1]; traceFade[i]->incRefCount(); } return new coDoSet(objName, traceFade.size(), &traceFade[0]); } else { coDoFloat *floats = new coDoFloat(objName, steps*m_particleSelection.size()); float *data = floats->getAddress(); for (size_t particle = 0; particle < m_particleSelection.size(); particle++) { for (size_t j = 0; j < steps; j++) { size_t idx = m_particleSelection.size()*particle+j; data[idx] = alternative(particle / (float)m_particleSelection.size(), j-m_timestepStart); } } return floats; } }
forceinline bool NextSolCursor::mayMoveSidewards(void) { if (back) { return notOnSol() && !node()->isRoot() && alternative() > 0; } else { return notOnSol() && !node()->isRoot() && (alternative() < node()->getParent(na)->getNumberOfChildren() - 1); } }
void AnalyticHiearchyModel::onAlternativeChanged(QModelIndex first, QModelIndex last) { for(int i = first.row(); i <= last.row(); i++) { emit alternativeNameChanged(i, alternative(i)); } }
int main() { FSM* fsm = concat(closure(alternative(createCharacter('a'), createCharacter('b'))), concat(createCharacter('a'), concat(createCharacter('b'), createCharacter('b')))); printFsm(fsm); char buffer[100]; do { printf("String: "); scanf("%s", buffer); if (simulate(fsm, buffer)) { printf("%s wurde akzeptiert.\n", buffer); } else { printf("%s wurde nicht akzeptiert.\n", buffer); } } while (buffer[1]); freeFsm(fsm); }
constraint * store::default_value (const value& v) { alternative (v); return constraint::default_value (v); }