FinalStateMachine/src/main/java/me/bvn13/fsm/exceptions/AmbiguousTransitionExceptio...

21 lines
631 B
Java
Raw Normal View History

2022-07-07 02:15:12 +03:00
package me.bvn13.fsm.exceptions;
2017-12-28 15:30:26 +03:00
import java.util.List;
/**
2022-07-07 02:15:12 +03:00
* is thrown if there are more than 1 appropriate transition from current state
2017-12-28 15:30:26 +03:00
*/
2022-07-07 02:15:12 +03:00
public class AmbiguousTransitionException extends FsmException {
2017-12-28 15:30:26 +03:00
public AmbiguousTransitionException(String message) {
super(message);
}
public AmbiguousTransitionException(String from, List<String> next) {
super("");
String msg = "";
for (String to : next) {
msg += (msg.length() > 0 ? ", " : "") + to;
}
this.message = String.format("Ambiguous transition from state %s. Candidates are: %s", from, msg);
}
}