public synchronized void checkState(State... requiredStates) throws IllegalStateException {
  for (  State requiredState : requiredStates) {
    if (requiredState.equals(currentState)) {
      return;
    }
  }
  throw new IllegalStateException(String.format(Locale.US,"Expected states %s, but in state %s",Lists.newArrayList(requiredStates),currentState));
}

public synchronized void checkState ( State ... requiredStates ) throws IllegalStateException { for ( State requiredState : requiredStates ) { if ( requiredState . equals ( currentState ) ) { return ; } } throw new IllegalStateException ( String . format ( Locale . US , "Expected states %s, but in state %s" , Lists . newArrayList ( requiredStates ) , currentState ) ) ; }
checks that the machine is in one of the given states . throws if it isn ' t .
