sims.mdt
Class Tape

java.lang.Object
  extended by sims.mdt.Tape
All Implemented Interfaces:
java.lang.Cloneable, Errors

public class Tape
extends java.lang.Object
implements java.lang.Cloneable, Errors


Field Summary
 
Fields inherited from interface sims.mdt.Errors
error1, error10, error11, error12, error13, error2, error3, error4, error5, error6, error7, error8, error9
 
Constructor Summary
Tape(int number, java.util.HashMap h, Alphabet a)
          constructor for any tape except the first
Tape(java.lang.String word, java.util.HashMap h, Alphabet a)
          constructor for the first tape (number zero).
 
Method Summary
 java.lang.Object clone()
          redefinition needed to clone a Tape
 Alphabet getAlpha()
           
 java.lang.Character getAlphaLetter(int i)
           
 int getAlphaSize()
           
 int getMin()
           
 int getScannedSquare()
           
 java.lang.Character getScannedSymbol()
           
 int getSpace()
           
 java.lang.String getStatus()
           
 java.lang.String getTapeContent()
           
 java.lang.String getWord()
           
 boolean inAlphabet(java.lang.Character c)
           
 void setAlpha(int i, char c)
          Add a letter to this tape's alphabet.
 void setTapeContent(java.lang.String s)
          set the tape content, from its current min, as the specified String
 void setTapeStatus(java.util.HashMap rub)
          Set the tape content as the parameter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tape

public Tape(java.lang.String word,
            java.util.HashMap h,
            Alphabet a)
constructor for the first tape (number zero).

Parameters:
h - the hash table containing the tapes alphabets
a - the alphabet of the machine
word - the entry word

Tape

public Tape(int number,
            java.util.HashMap h,
            Alphabet a)
constructor for any tape except the first

Parameters:
h - the hash table containing the tapes alphabets
a - the alphabet of the machine
number - this tape's number.
Method Detail

inAlphabet

public boolean inAlphabet(java.lang.Character c)
Parameters:
c - the character we want to test.
Returns:
true if the parameter letter belongs to this tape's alphabet.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
redefinition needed to clone a Tape

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

setTapeStatus

public void setTapeStatus(java.util.HashMap rub)
Set the tape content as the parameter.

Parameters:
rub - a hash table describing a tape, taking as key an index value (signed Integer)

getScannedSymbol

public java.lang.Character getScannedSymbol()
Returns:
the letter fronting the head

getScannedSquare

public int getScannedSquare()
Returns:
the scanned square index.

getMin

public int getMin()
Returns:
the minimum cell reached (maximum value is zero, because it's the starting index).

getWord

public java.lang.String getWord()
Returns:
the word on the tape, from head to last non-blank char

getTapeContent

public java.lang.String getTapeContent()
Returns:
the tape content from leftmost to rightmost square visited (blanks included)

getStatus

public java.lang.String getStatus()
Returns:
the content of the tape, from minimumReached to last cell accessed

getSpace

public int getSpace()
Returns:
the number of cells visited, equals number of cells indexed in the hash ruban.

getAlphaLetter

public java.lang.Character getAlphaLetter(int i)
Returns:
the character indexed at i if exists, null otherwise.

getAlpha

public Alphabet getAlpha()
Returns:
the tape's alphabet, instance of Alphabet

getAlphaSize

public int getAlphaSize()
Returns:
the alphabet size, equals to the number of letters.

setAlpha

public void setAlpha(int i,
                     char c)
Add a letter to this tape's alphabet.

Parameters:
i - the index where to place the letter.
c - the letter to add.

setTapeContent

public void setTapeContent(java.lang.String s)
set the tape content, from its current min, as the specified String