-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransition.java
59 lines (48 loc) · 1.22 KB
/
Transition.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
public class Transition {
private State state1;
private char input;
private State state2;
private char output;
private Move move;
//Empty character is stored internally
private static final char emptyCharacter = '_';
public static final String LEFT = "L";
public static final String RIGHT = "R";
public Transition(State state1, char tape_input, State state2, char tape_output, Move move) {
this.state1 = state1;
this.input = tape_input;
this.state2 = state2;
this.output = tape_output;
this.move = move;
}
public State getInitialState() {
return state1;
}
public char getTapeInput() {
return input;
}
public State getResultState() {
return state2;
}
public char getTapeOutput() {
return output;
}
public String getMoveDirection() {
return move.getDirection();
}
/**
* This is called when runtm.printMachineDescription(TuringMachine machine) is called.
**/
public String print() {
String print = "";
print += "<" + state1.getName() + "> ";
print += "<" + input + "> ";
print += "<" + state2.getName() + "> ";
print += "<" + output + "> ";
print += "<" + move.getDirection() + ">";
return print;
}
public static char emptyCharacter() {
return emptyCharacter;
}
}