|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectro.inf.p2.odd.alan.Tape
ro.inf.p2.odd.alan.TuringMachine
public class TuringMachine
Class TuringMachine This class implements a complete Turing Machine which is described by the formula M = (Q,Sigma, Gamma, delta, q0, B, F) where: - Q is a finite set of states - Gamma is a finite set of the tape alphabet - Sigma is a finite set of the input symbols (subset of Gamma) - delta is the set of transistion functions - q0 is the initial state (member of Q) - B is the BLANK symbol - F is set of final accepting states (subset of Q) You can either execute the turing machine with execute and just get the results or walk step by step through the execution using start() and nextStep(). The turing machine can be checked for valid initialization with the isValid() method.
execute
,
start
,
nextStep
,
isValid
Nested Class Summary | |
---|---|
static class |
TuringMachine.Direction
This enum describes the possible ways to move for the tape. |
Field Summary | |
---|---|
static char |
BLANK
|
static java.io.File |
DEFAULT_FILE
|
Constructor Summary | |
---|---|
TuringMachine()
Create a new Turing Machine which will be initialized with default values. |
Method Summary | |
---|---|
boolean |
execute()
Executes the TuringMachine with the current settings. |
char |
getBlank()
Das Leerzeichen B. |
int |
getCurrentState()
Allows to retrieve the current state of the turing machine. |
java.lang.String |
getDescription()
Gets the description of this turing machine object |
java.util.List<java.lang.Integer> |
getFinalState()
F ist die Menge der akzeptierten Endzust?nde. |
java.lang.String |
getGamma()
VollstaendigeMenge der Bandsymbole. |
int |
getInitialState()
Index der Uebergangsfunktion in ro die den Start Zustand beschreibt. |
java.util.List<java.util.Map<java.lang.Character,TransitionFunctionElement>> |
getQ()
Endliche Menge der zust?nde der endlichen Steuerung. |
java.lang.String |
getSigma()
Die endliche menge der Eingabesymbole. |
boolean |
isValid()
Checks wether this machine can be started using start() safely. |
void |
loadDefaults()
Initialize the TuringMachine with default values, so that isValid returns true. |
boolean |
loadFromFile(java.io.File file)
Load the turing machines settings from a xml file which was created by TuringMachine.saveToFile() before. |
boolean |
nextStep()
Executes the next step of the turing machine. |
boolean |
saveToFile(java.io.File file)
Save all settings of the turing machine to a file in XML format. |
void |
setBlank(char value)
Das Leerzeichen B. |
void |
setDescription(java.lang.String description)
Sets the comment description of this turing machine object |
void |
setFinalState(java.util.List<java.lang.Integer> f)
F ist die Menge der akzeptierten Endzustaende. |
void |
setGamma(java.lang.String value)
VollstaendigeMenge der Bandsymbole. |
void |
setInitialState(int value)
Index der Uebergangsfunktion in ro die den Start Zustand beschreibt. |
void |
setQ(java.util.List<java.util.Map<java.lang.Character,TransitionFunctionElement>> value)
Endliche Menge der Zustaende der endlichen Steuerung. |
void |
setSigma(java.lang.String value)
Die endliche menge der Eingabesymbole. |
boolean |
start()
start the execution of the turing machine |
void |
stop()
stop execution of the turing machine |
Methods inherited from class ro.inf.p2.odd.alan.Tape |
---|
getCurrentValue, moveLeft, moveRight, moveStart, offsetToLeftMostChar, setContent, setCurrentValue, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final char BLANK
public static final java.io.File DEFAULT_FILE
Constructor Detail |
---|
public TuringMachine()
Method Detail |
---|
public boolean start()
public boolean nextStep() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
toString
public int getCurrentState()
public void stop()
public boolean execute()
public boolean isValid()
start
public void loadDefaults()
public boolean saveToFile(java.io.File file)
file
- File where the data is saved
public boolean loadFromFile(java.io.File file)
file
- load from this file
public java.util.List<java.util.Map<java.lang.Character,TransitionFunctionElement>> getQ()
public void setQ(java.util.List<java.util.Map<java.lang.Character,TransitionFunctionElement>> value)
public java.lang.String getSigma()
public void setSigma(java.lang.String value)
public java.lang.String getGamma()
public void setGamma(java.lang.String value)
public int getInitialState()
public void setInitialState(int value)
public char getBlank()
public void setBlank(char value)
public java.util.List<java.lang.Integer> getFinalState()
public void setFinalState(java.util.List<java.lang.Integer> f)
public java.lang.String getDescription()
public void setDescription(java.lang.String description)
description
- The comment description as a string
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |