/** * Returns a state reached from this state with the given symbol. If more than one state can be reached with the given symbol, an arbitrary one is returned. * * @param symbol * @return a state reached from this state with the given symbol, <code>null</code> otherwise */ public State<T> move(final T symbol) { for (final Transition<T> t : _transitions) if (t.hasName(symbol)) return t.getTo(); return null; }
/** * Returns a state reached from this state with the given symbol. If more than one state can be reached with the given symbol, an arbitrary one is returned. * * @param symbol * @return a state reached from this state with the given symbol, <code>null</code> otherwise */ public State<T> move(final T symbol) { for (final Transition<T> t : _transitions) if (t.hasName(symbol)) return t.getTo(); return null; }
public boolean isConnected() { final Set<State<T>> visited = new HashSet<>(); final Stack<State<T>> stack = new Stack<>(); stack.push(_initialState); visited.add(_initialState); while (!stack.isEmpty()) { final State<T> state = stack.pop(); if (!_allStates.contains(state)) return false; for (final Transition<T> t : state.getTransitions()) if (visited.add(t.getTo())) stack.push(t.getTo()); } return visited.size() == _allStates.size(); }
public boolean isConnected() { final Set<State<T>> visited = new HashSet<>(); final Stack<State<T>> stack = new Stack<>(); stack.push(_initialState); visited.add(_initialState); while (!stack.isEmpty()) { final State<T> state = stack.pop(); if (!_allStates.contains(state)) return false; for (final Transition<T> t : state.getTransitions()) if (visited.add(t.getTo())) stack.push(t.getTo()); } return visited.size() == _allStates.size(); }
public TransitionGraph<T> renumber() { final Set<State<T>> processed = new HashSet<>(); final LinkedList<State<T>> workList = new LinkedList<>(); int val = 0; workList.addFirst(_initialState); while (workList.size() > 0) { final State<T> s = workList.removeFirst(); s.setName(val++); processed.add(s); for (final Transition<T> e : s.getTransitions()) if (processed.add(e.getTo())) workList.addLast(e.getTo()); } return this; }
public TransitionGraph<T> renumber() { final Set<State<T>> processed = new HashSet<>(); final LinkedList<State<T>> workList = new LinkedList<>(); int val = 0; workList.addFirst(_initialState); while (workList.size() > 0) { final State<T> s = workList.removeFirst(); s.setName(val++); processed.add(s); for (final Transition<T> e : s.getTransitions()) if (processed.add(e.getTo())) workList.addLast(e.getTo()); } return this; }
public Set<State<T>> move(final Set<State<T>> stateSet, final T c) { final Set<State<T>> result = new HashSet<>(); // for all the states in the set SS for (final State<T> st : stateSet) // for all the edges from state st for (final Transition<T> e : st.getTransitions()) // add the 'to' state if transition matches if (e.hasName(c)) result.add(e.getTo()); return result; }
public Set<State<T>> epsilonClosure(final State<T> s, final Set<State<T>> init) { Set<State<T>> result = init; // s is in the epsilon closure of itself result.add(s); // for each edge from s for (final Transition<T> e : s.getTransitions()) // if this is an epsilon transition and the result // does not contain 'to' state then add the epsilon // closure of 'to' state to the result set if (e.isEpsilon() && !result.contains(e.getTo())) result = epsilonClosure(e.getTo(), result); return result; }
public Set<State<T>> move(final Set<State<T>> stateSet, final T c) { final Set<State<T>> result = new HashSet<>(); // for all the states in the set SS for (final State<T> st : stateSet) // for all the edges from state st for (final Transition<T> e : st.getTransitions()) // add the 'to' state if transition matches if (e.hasName(c)) result.add(e.getTo()); return result; }
public Set<State<T>> epsilonClosure(final State<T> s, final Set<State<T>> init) { Set<State<T>> result = init; // s is in the epsilon closure of itself result.add(s); // for each edge from s for (final Transition<T> e : s.getTransitions()) // if this is an epsilon transition and the result // does not contain 'to' state then add the epsilon // closure of 'to' state to the result set if (e.isEpsilon() && !result.contains(e.getTo())) result = epsilonClosure(e.getTo(), result); return result; }
edge.setTo(partitionRep.get(edge.getTo()));
edge.setTo(partitionRep.get(edge.getTo()));
final State<T> s2 = t.getTo();
final State<T> s2 = t.getTo();
private State<Role> copyState(final State<Role> oldState, final TransitionGraph<Role> newTG, final Map<State<Role>, State<Role>> newStates) { State<Role> newState = newStates.get(oldState); if (newState == null) { newState = newTG.newState(); newStates.put(oldState, newState); for (final Transition<Role> t : oldState.getTransitions()) { final State<Role> oldTo = t.getTo(); final State<Role> newFrom = copyState(oldTo, newTG, newStates); if (t.isEpsilon()) newTG.addTransition(newFrom, newState); else newTG.addTransition(newFrom, t.getName().getInverse(), newState); } } return newState; } }
private State<Role> copyState(final State<Role> oldState, final TransitionGraph<Role> newTG, final Map<State<Role>, State<Role>> newStates) { State<Role> newState = newStates.get(oldState); if (newState == null) { newState = newTG.newState(); newStates.put(oldState, newState); for (final Transition<Role> t : oldState.getTransitions()) { final State<Role> oldTo = t.getTo(); final State<Role> newFrom = copyState(oldTo, newTG, newStates); if (t.isEpsilon()) newTG.addTransition(newFrom, newState); else newTG.addTransition(newFrom, t.getName().getInverse(), newState); } } return newState; } }
final Individual value = (Individual) edge.getNeighbor(subj); getComplexObjectPropertyValues(value, t.getTo(), tg, knowns, unknowns, getSames, visited, isIndependent && ds.isIndependent());
final Individual value = (Individual) edge.getNeighbor(subj); getComplexObjectPropertyValues(value, t.getTo(), tg, knowns, unknowns, getSames, visited, isIndependent && ds.isIndependent());