|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmodel.tape<T>
public class tape<T>
A simple reimplementation of an array doubling with two direction movements null represent the empty symbol of the alphabet Copyright (C) 2011 Federico "MrModd" Cosentino (http://mrmodd.it/)
Field Summary | |
---|---|
private java.util.List<T> |
Left
|
private java.util.List<T> |
Right
|
private static long |
serialVersionUID
|
private T |
zero
|
Constructor Summary | |
---|---|
tape()
Create a tape the initial dimension is 3 for Left and Right lists |
|
tape(int dim)
Create a tape |
Method Summary | |
---|---|
void |
erase()
Clear all the elements in the tape |
T |
get(int index)
Get the symbol at the index position |
boolean |
isEmpty()
Check if the tape contains some symbols |
boolean |
putLeft(T e)
Add an element to the Left list |
boolean |
putRight(T e)
Add an element to the Right list |
void |
set(int index,
T e)
Set a symbol on the specified index of the tape. |
int |
size()
Get the dimension of the written tape |
int |
sizeLeft()
Get the dimension of the Left array |
int |
sizeRight()
Get the dimension of the Right array |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private java.util.List<T> Left
private java.util.List<T> Right
private T zero
Constructor Detail |
---|
public tape()
public tape(int dim)
dim
- initial dimension for the Left and Right listsMethod Detail |
---|
public boolean putLeft(T e)
e
- the element to add
public boolean putRight(T e)
e
- the element to add
public void set(int index, T e) throws java.lang.IllegalArgumentException
index
- could be positive or negativee
- symbol to write in at the specified position
java.lang.IllegalArgumentException
- if index is far more than one step from the end of the written string
(the TM could not move more than one step from his current location)public T get(int index)
index
- could be positive or negative
public boolean isEmpty()
public int size()
public int sizeLeft()
public int sizeRight()
public void erase()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |