Transition.java


Below is the syntax highlighted version of Transition.java from §5.2 Turing Machines.


public class Transition {
    public final static String DELIMITER = "|";
    private State from, to;
    private String read, write;

    public Transition(State from, State to, String read, String write) {
        this.from = from;
        this.to = to;
        this.read = read;
        this.write = write;
    }

    public String getWrite()    { return write; }
    public State getNextState() { return to;    }

    public String toString() {
        return "from: " + from + ", to: " + to + ", read: " + read + ", write: " + write;
    }
}


Copyright © 2000–2017, Robert Sedgewick and Kevin Wayne.
Last updated: Fri Oct 20 14:12:12 EDT 2017.