|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.parser.Operation
edu.neu.ccs.parser.BooleanOperation
Class used to store a boolean operation.
As of 2.5.0, this class was extracted from the class
JPTParser and made standalone.
Unlike Operation, this class is concrete
in order to allow some methods that may not be needed to
use the default implementation that returns
null.
Operations that will be used must be overridden.
| Field Summary | |
protected boolean |
booleanOrNumeric
Whether or not the operation can accept boolean or numeric arguments. |
| Fields inherited from class edu.neu.ccs.parser.Operation |
IDENTITY, OPERATION_PREFIX |
| Constructor Summary | |
BooleanOperation(String s)
Constructs an operation with the given symbol. |
|
BooleanOperation(String s,
boolean unary,
boolean binary)
Constructs an operation with the given symbol and settings for unary and binary usage. |
|
BooleanOperation(String s,
boolean unary,
boolean binary,
boolean b_or_n)
Constructs an operation with the given symbol and settings for unary and binary usage. |
|
| Method Summary | |
Object |
binaryForXBoolean(XBoolean p,
XBoolean q)
Override this method to specify the result of this operation acting as a binary operation on boolean arguments. |
Object |
binaryForXFloating(XDouble x,
XDouble y)
Override this method to specify the result of this operation acting as a binary operation on floating arguments. |
Object |
binaryForXIntegral(XBigInteger a,
XBigInteger b)
Override this method to specify the result of this operation acting as a binary operation on integral arguments. |
boolean |
handlesBooleanOrNumeric()
Returns whether or not the operation can accept boolean or numeric arguments. |
Object |
performOperation(Object left,
Object right)
Performs the operation on the given values and returns the result. |
Object |
unaryForXBoolean(XBoolean p)
Override this method to specify the result of this operation acting as a unary operation on a boolean argument. |
Object |
unaryForXFloating(XDouble x)
Override this method to specify the result of this operation acting as a unary operation on a floating argument. |
Object |
unaryForXIntegral(XBigInteger a)
Override this method to specify the result of this operation acting as a unary operation on an integral argument. |
| Methods inherited from class edu.neu.ccs.parser.Operation |
checkBinary, checkUnary, isBinary, isUnary, symbol |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected boolean booleanOrNumeric
| Constructor Detail |
public BooleanOperation(String s)
s - the symbol() for the operation
public BooleanOperation(String s,
boolean unary,
boolean binary)
s - the symbol() for the operationunary - whether the operation may be unarybinary - whether the operation may be binary
public BooleanOperation(String s,
boolean unary,
boolean binary,
boolean b_or_n)
s - the symbol() for the operationunary - whether the operation may be unarybinary - whether the operation may be binaryb_or_n - whether the operation can accept
boolean or numeric arguments| Method Detail |
public final Object performOperation(Object left,
Object right)
throws ParseException
Performs the operation on the given values and returns the result.
performOperation in class Operationleft - 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 final boolean handlesBooleanOrNumeric()
public Object unaryForXBoolean(XBoolean p)
p - the argument
public Object binaryForXBoolean(XBoolean p,
XBoolean q)
p - argument 1q - argument 2public Object unaryForXIntegral(XBigInteger a)
a - the argument
public Object binaryForXIntegral(XBigInteger a,
XBigInteger b)
a - argument 1b - argument 2public Object unaryForXFloating(XDouble x)
x - the argument
public Object binaryForXFloating(XDouble x,
XDouble y)
x - argument 1y - argument 2
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||