|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--edu.neu.ccs.parser.AbstractParser.Operation
Class encapsulating an operation
and its corresponding String symbol
for use with a parser.
Parser| Field Summary | |
boolean |
isBinary
Whether or not the operation can act as a binary operation. |
boolean |
isUnary
Whether or not the operation can act as a unary operation. |
String |
symbol
The symbol representing this operation. |
| Constructor Summary | |
AbstractParser.Operation()
Constructs an operation with the default initial settings. |
|
AbstractParser.Operation(String s)
Constructs an operation with the given symbol. |
|
AbstractParser.Operation(String s,
boolean unary,
boolean binary)
Constructs an operation with the given symbol and settings for unary and binary usage. |
|
| Method Summary | |
protected void |
checkBinary()
Throws parseException if operation cannot act as binary. |
protected void |
checkUnary()
Throws parseException if operation cannot act as unary. |
boolean |
isBinary()
Returns true if the operation may act as a binary operation. |
boolean |
isUnary()
Returns true if the operation may act as a unary operation. |
Object |
performOperation(Object left,
Object right)
Performs the operation on the given values and returns the result. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public String symbol
public boolean isUnary
public boolean isBinary
| Constructor Detail |
public AbstractParser.Operation()
public AbstractParser.Operation(String s)
s - the symbol for the operation
public AbstractParser.Operation(String s,
boolean unary,
boolean binary)
s - the symbol for the operationunary - whether the operation may be unarybinary - whether the operation may be binary| Method Detail |
public Object performOperation(Object left,
Object right)
throws ParseException
left - the left side operand for a binary operation
or null for a unary operationright - the right side operand for a unary or binary
operation
ParseExceptionpublic boolean isUnary()
public boolean isBinary()
protected void checkUnary()
throws ParseException
ParseException
protected void checkBinary()
throws ParseException
ParseException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||