|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmars.assembler.TokenList
public class TokenList
Represents the list of tokens in a single line of MIPS code. It uses, but is not a subclass of, ArrayList.
Constructor Summary | |
---|---|
TokenList()
Constructor for objects of class TokenList |
Method Summary | |
---|---|
void |
add(Token token)
Adds a Token object to the end of the list. |
Object |
clone()
Makes clone (shallow copy) of this token list object. |
Token |
get(int pos)
Returns requested token given position number (starting at 0). |
String |
getProcessedLine()
Retrieve the source line String associated with this token list. |
boolean |
isEmpty()
Returns empty/non-empty status of list. |
void |
remove(int pos)
Removes Token object at specified list position. |
void |
set(int pos,
Token replacement)
Replaces token at position with different one. |
void |
setProcessedLine(String line)
Use this to record the source line String for this token list after possible modification (textual substitution) during assembly preprocessing. |
int |
size()
Returns number of tokens in list. |
String |
toString()
Get a String representing the token list. |
String |
toTypeString()
Get a String representing the sequence of token types for this list. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TokenList()
Method Detail |
---|
public void setProcessedLine(String line)
line
- The source line, possibly modified (possibly not)public String getProcessedLine()
public Token get(int pos)
pos
- Position in token list.
public void set(int pos, Token replacement)
pos
- Position in token list.replacement
- Replacement tokenpublic int size()
public void add(Token token)
token
- Token object to be added.public void remove(int pos)
pos
- Position in token list. Subsequent Tokens are shifted one position left.
IndexOutOfBoundsException
- if pos is < 0 or >= size()public boolean isEmpty()
public String toString()
toString
in class Object
public String toTypeString()
public Object clone()
clone
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |