|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.endeca.navigation.analytics.ExprBinary
public class ExprBinary
An ExprBinary
is a type of Expr
that
represents a binary scalar expression. These expressions
provide a full range of mathematical functions, such as addition
and subtraction operators.
For example, this code subtracts one from an integer property named "Year":
LookupList lookup = new LookupList();
lookup.add(new ExprBinary(ExprBinary.MINUS, new ExprKey("Year"), new ExprConstant("1")));
In the example, the ExprBinary
object is set in a LookupList
object.
Nested Class Summary | |
---|---|
static class |
ExprBinary.ExprBinaryOp
Enumeration of Endeca mathematical operators. |
Field Summary | |
---|---|
static ExprBinary.ExprBinaryOp |
DIVIDE
Division operator. |
static ExprBinary.ExprBinaryOp |
LOG
Logarithm operator. |
static ExprBinary.ExprBinaryOp |
MINUS
Subtraction operator. |
static ExprBinary.ExprBinaryOp |
MOD
Modulo (remainder) operator. |
static ExprBinary.ExprBinaryOp |
MULTIPLY
Multiplication operator. |
static ExprBinary.ExprBinaryOp |
PLUS
Addition operator. |
static ExprBinary.ExprBinaryOp |
POWER
Exponentiation operator. |
static ExprBinary.ExprBinaryOp |
ROUND
Round operator. |
static ExprBinary.ExprBinaryOp |
TRUNC
Truncation operator. |
Constructor Summary | |
---|---|
ExprBinary(ExprBinary.ExprBinaryOp function,
Expr lhs,
Expr rhs)
Creates a new ExprBinary expression node. |
Method Summary | |
---|---|
ExprBinary.ExprBinaryOp |
getFunction()
Gets the mathematical function for this ExprBinary . |
Expr |
getLhs()
Gets the left-hand side of this ExprBinary expression node.. |
Expr |
getRhs()
Gets the right-hand side of this ExprBinary expression node.. |
void |
setFunction(ExprBinary.ExprBinaryOp function)
Sets the mathematical function for this ExprBinary . |
void |
setLhs(Expr expr)
Sets the left-hand side of this binary expression. |
void |
setRhs(Expr expr)
Sets the right-hand side of this binary expression. |
String |
toString()
Returns the string form of this ExprBinary . |
String |
toWire()
Returns the wire form of this ExprBinary . |
void |
validateSyntax()
Validates the syntax of this ExprBinary . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final ExprBinary.ExprBinaryOp PLUS
public static final ExprBinary.ExprBinaryOp MINUS
public static final ExprBinary.ExprBinaryOp MULTIPLY
public static final ExprBinary.ExprBinaryOp DIVIDE
public static final ExprBinary.ExprBinaryOp LOG
public static final ExprBinary.ExprBinaryOp MOD
public static final ExprBinary.ExprBinaryOp POWER
public static final ExprBinary.ExprBinaryOp ROUND
public static final ExprBinary.ExprBinaryOp TRUNC
Constructor Detail |
---|
public ExprBinary(ExprBinary.ExprBinaryOp function, Expr lhs, Expr rhs)
ExprBinary
expression node.
The ExprBinary
will compute the
specified function
on the specified lhs
and rhs
parameters.
function
- a mathematical function (of type ExprBinary.ExprBinaryOp
)
that specifies the type of operation to be made. See the
setFunction
method for a list of the
function names.lhs
- an object of type Expr
that will be
the left-hand side of this binary expression.rhs
- an object of type Expr
that will be
the right-hand side of this binary expression.Method Detail |
---|
public void setLhs(Expr expr)
expr
must be of type Expr
, such as
an ExprKey
object.
expr
- an object of type Expr
that will be
the left-hand side of this binary expression.public Expr getLhs()
ExprBinary
expression node..
Expr
that is the left-hand side
of this ExprBinary
.public void setRhs(Expr expr)
expr
must be of type Expr
, such as
an ExprConstant
object.
expr
- an object of type Expr
that will be
the right-hand side of this binary expression.public Expr getRhs()
ExprBinary
expression node..
Expr
that is the right-hand side
of this ExprBinary
.public void setFunction(ExprBinary.ExprBinaryOp function)
ExprBinary
.
These functions specify the type of mathematical operation to be performed
using the left-hand and right-hand sides of the expression.
function
- a mathematical function (of type ExprBinary.ExprBinaryOp
)
that specifies the type of operation to be made.
The functions are: ExprBinary.DIVIDE
,
ExprBinary.LOG
, ExprBinary.MINUS
,
ExprBinary.MOD
, ExprBinary.MULTIPLY
,
ExprBinary.PLUS
, ExprBinary.POWER
,
ExprBinary.ROUND
, and ExprBinary.TRUNC
.public ExprBinary.ExprBinaryOp getFunction()
ExprBinary
.
ExprBinary.ExprBinaryOp
)
for this ExprBinary
.
See the setFunction
method for a list of the
function names.public String toString()
ExprBinary
. The format
for the DIVIDE, MINUS, MULTIPLY, and PLUS operators is:
"lhs-expression sign rhs-expression"where sign is / (for DIVIDE), - (for MINUS), * (for MULTIPY), or + (for PLUS).
The format for the other operators is:
"op(lhs-expression, rhs-expression)"where op is LOG, MOD, POWER, BROUND, or BTRUNC.
toString
in interface QueryNode
toString
in class Object
ExprBinary
in the specified format.public String toWire()
ExprBinary
. This method is not
intended for public use because the wire format is subject to change.
toWire
in interface QueryNode
ExprBinary
.public void validateSyntax() throws SyntaxException
ExprBinary
.
An ExprBinary
is valid if both the right-hand side and left-hand
side subexpressions are non-null and valid, and the function is
not null.
validateSyntax
in interface QueryNode
SyntaxException
- if the syntax requirements are not satisfied.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |