|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--GroupingSymbolTable
Much like OperatorTable this call serves as a holder for a set of other objects
and acts as an interface to allow use of them. In this case the objects are
GroupingSymbols.
The most common usage of GroupingSymbolTable is GenericGroupingSymbolTable.
| Field Summary | |
protected int |
capacity
The current maximum number of elements possible |
protected int |
size
The current number of elements |
protected GroupingSymbol[] |
symbols
The elements contained in the table |
| Constructor Summary | |
GroupingSymbolTable()
Creates a new empty table with a capacity of 20 elements |
|
GroupingSymbolTable(int i)
Creates a new empty table with a capacity of i elements. |
|
| Method Summary | |
void |
add(GroupingSymbol o)
Adds a GroupingSymbol to the table. |
java.lang.String[] |
getTokens()
|
boolean |
isAClosingSymbol(java.lang.String token)
Identifies String token as being an closing symbol or not. |
boolean |
isAGroupingSymbol(java.lang.String token)
Identifies String token as being a symbol in the table or not. |
boolean |
isAnOpeningSymbol(java.lang.String token)
Identifies String token as being an opening symbol or not. |
boolean |
isBalanced(java.lang.String s)
Checks if an infix expression is balanced. |
GroupingSymbol |
symbolFor(java.lang.String token)
Identifies String token and returns the appropriate
GroupingSymbol. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected int capacity
protected int size
protected GroupingSymbol[] symbols
| Constructor Detail |
public GroupingSymbolTable()
public GroupingSymbolTable(int i)
| Method Detail |
public void add(GroupingSymbol o)
GroupingSymbol to the table. If there is not room in the table for
the symbol then (in the fashion of Vector) the capacity is
doubled thereby making space.o - symbol to be addedpublic boolean isAGroupingSymbol(java.lang.String token)
String token as being a symbol in the table or not.token - String to be identifiedtrue if token is in the tablepublic boolean isAnOpeningSymbol(java.lang.String token)
String token as being an opening symbol or not.
If token is not in the table then a NotATableElementExcepetion
will be thrown (once I get that running.)token - String to be identifiedtrue if token may begin a grouppublic boolean isAClosingSymbol(java.lang.String token)
String token as being an closing symbol or not.
If token is not in the table then a NotATableElementExcepetion
will be thrown (once I get that running.)token - String to be identifiedtrue if token may end a grouppublic GroupingSymbol symbolFor(java.lang.String token)
String token and returns the appropriate
GroupingSymbol.
If token is not in the table then a NotATableElementExcepetion
will be thrown (once I get that running.)token - String to be identifiedGroupingSymbol for token.public java.lang.String[] getTokens()
String array contianing the tokens for the
GroupingSymbols in the table.public boolean isBalanced(java.lang.String s)
s - infix equation to check the balance ofs is balanced or not
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||