edu.neu.ccs.parser
Class JPTParser.BooleanOperation

java.lang.Object
  |
  +--edu.neu.ccs.parser.AbstractParser.Operation
        |
        +--edu.neu.ccs.parser.JPTParser.BooleanOperation
Enclosing class:
JPTParser

public static class JPTParser.BooleanOperation
extends AbstractParser.Operation

Class used to store a boolean operation.

Replaces the class named BooleanOperator.

Since:
2.2

Field Summary
 boolean booleanOrNumeric
          Whether or not the operation can accept boolean or numeric arguments.
 
Fields inherited from class edu.neu.ccs.parser.AbstractParser.Operation
isBinary, isUnary, symbol
 
Constructor Summary
JPTParser.BooleanOperation()
          Constructs an operation with the default symbol.
JPTParser.BooleanOperation(String s)
          Constructs an operation with the given symbol.
JPTParser.BooleanOperation(String s, boolean unary, boolean binary)
          Constructs an operation with the given symbol and settings for unary and binary usage.
JPTParser.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.
 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.AbstractParser.Operation
checkBinary, checkUnary, isBinary, isUnary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

booleanOrNumeric

public boolean booleanOrNumeric
Whether or not the operation can accept boolean or numeric arguments.

Constructor Detail

JPTParser.BooleanOperation

public JPTParser.BooleanOperation()
Constructs an operation with the default symbol.


JPTParser.BooleanOperation

public JPTParser.BooleanOperation(String s)
Constructs an operation with the given symbol.

Parameters:
s - the symbol for the operation

JPTParser.BooleanOperation

public JPTParser.BooleanOperation(String s,
                                  boolean unary,
                                  boolean binary)
Constructs an operation with the given symbol and settings for unary and binary usage.

Parameters:
s - the symbol for the operation
unary - whether the operation may be unary
binary - whether the operation may be binary

JPTParser.BooleanOperation

public JPTParser.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.

Parameters:
s - the symbol for the operation
unary - whether the operation may be unary
binary - whether the operation may be binary
b_or_n - whether the operation can accept boolean or numeric arguments
Method Detail

performOperation

public final Object performOperation(Object left,
                                     Object right)
                              throws ParseException
Performs the operation on the given values and returns the result. Replaces the method named operationPerformed.

Overrides:
performOperation in class AbstractParser.Operation
Parameters:
left - the left side operand for a binary operation or null for a unary operation
right - the right side operand for a unary or binary operation
ParseException
Since:
2.2

unaryForXBoolean

public Object unaryForXBoolean(XBoolean p)
Override this method to specify the result of this operation acting as a unary operation on a boolean argument.

Parameters:
p - the argument

binaryForXBoolean

public Object binaryForXBoolean(XBoolean p,
                                XBoolean q)
Override this method to specify the result of this operation acting as a binary operation on boolean arguments.

Parameters:
p - argument 1
q - argument 2

unaryForXIntegral

public Object unaryForXIntegral(XBigInteger a)
Override this method to specify the result of this operation acting as a unary operation on an integral argument.

Parameters:
a - the argument

binaryForXIntegral

public Object binaryForXIntegral(XBigInteger a,
                                 XBigInteger b)
Override this method to specify the result of this operation acting as a binary operation on integral arguments.

Parameters:
a - argument 1
b - argument 2

unaryForXFloating

public Object unaryForXFloating(XDouble x)
Override this method to specify the result of this operation acting as a unary operation on a floating argument.

Parameters:
x - the argument

binaryForXFloating

public Object binaryForXFloating(XDouble x,
                                 XDouble y)
Override this method to specify the result of this operation acting as a binary operation on floating arguments.

Parameters:
x - argument 1
y - argument 2