|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--GroupingSymbol
This class represents a grouping symbol in an equation. Grouping symbols are used
to change the order in which an infix equation is solved. Normally an equation is solved
it is solved left to right and according to the order of operations. Grouping symbols
allow one to specify that certain operations which would normally occur later in the
solving can occur earlier.
Parentheses are common grouping symbols for instance. The use of parentheses allows one
to change the meaning of 3 + 4 / 14 from 3 2/7 to (3 + 4) / 14 which is 7.
I am thinking that no further explanation is needed. This should have been covered in
fifth grade or so.
Field Summary | |
java.lang.String |
closeToken
Symbol representing that a group has been closed |
boolean |
openingSymbol
flag telling whether or not this particular symbol instance was an open or a close |
java.lang.String |
openToken
Symbol representing that a group has been begun |
Constructor Summary | |
GroupingSymbol(java.lang.String o,
java.lang.String c)
Calls GroupingSymbol(String, String, boolean) with a default
of the symbol being an opening symbol. |
|
GroupingSymbol(java.lang.String o,
java.lang.String c,
boolean opening)
A GroupingSymbol is created not simply with the actual token
that it represents but also the close for that symbol. |
Method Summary | |
boolean |
isAClosingSymbol()
Tells if the current symbol represents the close of a group |
boolean |
isAnOpeningSymbol()
Tells if the current symbol represents the beginning of a group |
boolean |
isCloseFor(GroupingSymbol o)
Tells whether o is the opposing symbol for this symbol. |
java.lang.String |
token()
Returns the appropriate token representing this grouping symbol. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public java.lang.String openToken
public java.lang.String closeToken
public boolean openingSymbol
Constructor Detail |
public GroupingSymbol(java.lang.String o, java.lang.String c)
GroupingSymbol(String, String, boolean)
with a default
of the symbol being an opening symbol.o
- the opening symbolc
- the closing symbolpublic GroupingSymbol(java.lang.String o, java.lang.String c, boolean opening)
GroupingSymbol
is created not simply with the actual token
that it represents but also the close for that symbol. This is done
because a grouping symbol is worthless unless its close is known.o
- the opening symbolc
- the closing symbolopening
- flag telling whether this particular symbol represents
the open or the close for this pairMethod Detail |
public boolean isCloseFor(GroupingSymbol o)
o
- the grouping symbol to be checked againstpublic java.lang.String token()
openToken
is returned
otherwise closeToken
is returned.public java.lang.String toString()
token()
public boolean isAnOpeningSymbol()
true
if the symbol begins a grouppublic boolean isAClosingSymbol()
true
if the symbol closes a group
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |