コード例 #1
0
 private void checkDestinationStates(States<S> states, AcceptingStates<S> acceptingStates)
     throws WrongAcceptingTargetStatesException {
   Iterator iterator = states.iterator();
   while (iterator.hasNext()) {
     State state = (State<S>) iterator.next();
     Set<State<S>> targetStates = acceptingStates.get(state);
     // Testing for targetStates != null means that if 'state' is a final state
     // testing for containsAll returns false and incorrectly throwing an exception
     if (targetStates != null && !states.containsAll(targetStates))
       throw new WrongAcceptingTargetStatesException(state);
   }
 }
コード例 #2
0
 private void checkStartingStates(States<S> states, AcceptingStates<S> acceptingStates)
     throws WrongInitialAcceptingStatesException {
   if (!states.containsAll(acceptingStates.keySet()))
     throw new WrongInitialAcceptingStatesException();
 }