Class TEDTM

java.lang.Object
  |
  +--TEDTM
All Implemented Interfaces:
java.lang.Runnable

public class TEDTM
extends java.lang.Object
implements java.lang.Runnable


Constructor Summary
TEDTM()
           
TEDTM(boolean setInMiddle, java.lang.StringBuffer alphabet, java.lang.StringBuffer finalTape, java.util.Vector finalRules, TEDController controller)
          Constructor This makes a new Turing Machine.
 
Method Summary
 TEDTM copy()
          copy() This method copies the TM object.
 java.lang.String getTapeCel(int x)
          getTapeCel
 int getTapeHeadPos()
          getTapeHeadPos Returns the current position of the tapehead.
 void halt()
          halt Makes the Turing Machine halt.
 void initializeRules(java.util.Vector finalRules)
          initializeRules Sets up the rules for a new Turing Machine.
 void initializeTape(java.lang.StringBuffer startingTape)
          initializeTape Sets up the tape for a new Turing Machine.
 void ludicrousSpeed(java.io.PrintWriter printOut)
          ludicrousSpeed Runs the Turing Machine at ludicrous speed.
 java.lang.StringBuffer makeSerialNumber()
          makeSerialNumber() This method creates a serial number for this turing machine
 void run()
          run Runs the Turing Machine at run speed, about 1 transition per second until we halt, or the user pushes the halt button.
 void runTransition()
          runTransition This will execute one transition on the current Turing Machine and set itself up to run the next transition.
 void stepSpeed()
          stepSpeed Runs the Turing Machine at step speed, only one transition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TEDTM

public TEDTM(boolean setInMiddle,
             java.lang.StringBuffer alphabet,
             java.lang.StringBuffer finalTape,
             java.util.Vector finalRules,
             TEDController controller)
Constructor This makes a new Turing Machine.
Parameters:
setInMiddle - whether or not the tape should start in the middle of the tape.
finalTape - the parsed and validated input that was given to be the tape.
finalRules -  

TEDTM

public TEDTM()
Method Detail

initializeTape

public void initializeTape(java.lang.StringBuffer startingTape)
initializeTape Sets up the tape for a new Turing Machine.
Parameters:
startingTape - the input that was given to us in the constructor

initializeRules

public void initializeRules(java.util.Vector finalRules)
initializeRules Sets up the rules for a new Turing Machine.
Parameters:
startingTape - the input that was given to us in the constructor

getTapeHeadPos

public int getTapeHeadPos()
getTapeHeadPos Returns the current position of the tapehead.
Returns:
the value of the tapehead.

stepSpeed

public void stepSpeed()
stepSpeed Runs the Turing Machine at step speed, only one transition.

run

public void run()
run Runs the Turing Machine at run speed, about 1 transition per second until we halt, or the user pushes the halt button.
Specified by:
run in interface java.lang.Runnable

ludicrousSpeed

public void ludicrousSpeed(java.io.PrintWriter printOut)
                    throws java.io.IOException
ludicrousSpeed Runs the Turing Machine at ludicrous speed. If the Turing Machine executes 10000 transitions or the user halts, then the Turing Machine will stop execution.

runTransition

public void runTransition()
runTransition This will execute one transition on the current Turing Machine and set itself up to run the next transition.

halt

public void halt()
halt Makes the Turing Machine halt.

getTapeCel

public java.lang.String getTapeCel(int x)
getTapeCel
Parameters:
x: - the cell of the tape which we want to get
Returns:
the String at the cell[x] of the tape padded with 3 spaces

makeSerialNumber

public java.lang.StringBuffer makeSerialNumber()
makeSerialNumber() This method creates a serial number for this turing machine
Returns:
the serial number

copy

public TEDTM copy()
copy() This method copies the TM object.
Returns:
the copy of the turing machine.