|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcetus.hir.Expression
cetus.hir.MinMaxExpression
public class MinMaxExpression
Class for MIN() MAX() expressions - these are equivalent to conditional expressions.
| Field Summary |
|---|
| Fields inherited from class cetus.hir.Expression |
|---|
children, needs_parens, object_print_method, parent |
| Constructor Summary | |
|---|---|
MinMaxExpression(boolean ismin)
Constructor with predefined min/max operator. |
|
MinMaxExpression(boolean ismin,
Expression lhs,
Expression rhs)
Constructor with two operands. |
|
| Method Summary | |
|---|---|
void |
add(Expression e)
Adds an operand to the existing expression. |
int |
compareTo(Expression e)
Compares MinMaxExpression to another expression. |
java.lang.Integer |
compareTo(int num)
Compares MinMaxExpression to an integer value. |
static void |
defaultPrint(MinMaxExpression minmax,
java.io.OutputStream stream)
Prints out MIN/MAX expressions. |
boolean |
isMin()
Returns true if this is a MIN expression. |
boolean |
isNegMin()
Checks if this expression is a MIN expression having at least one operand with negative value. |
boolean |
isPosMax()
Checks if this expression is a MIN expression having at least one operand with positive value. |
Expression |
negate()
Negates the expression by switching the operator and the signs of the operands. |
void |
setMin(boolean ismin)
Sets the expression type. |
Expression |
simplify()
Simplifies a MinMaxExpression as much as possible by removing duplicates and by matching special cases. |
Expression |
toConditionalExpression()
Converts MinMaxExpression to an equivalent conditional expression. |
java.lang.String |
toString()
Every expression class should override toString method. |
| Methods inherited from class cetus.hir.Expression |
|---|
clone, equals, equals2, findExpression, getChildren, getParent, getStatement, needsParens, print, printSelf, removeChild, setChild, setParens, setParent, setPrintMethod, swapWith, verify |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MinMaxExpression(boolean ismin)
ismin - true if the operator is MIN, false otherwise
public MinMaxExpression(boolean ismin,
Expression lhs,
Expression rhs)
ismin - true if the operator is MIN, false otherwiselhs - the first operandrhs - the second operand| Method Detail |
|---|
public static void defaultPrint(MinMaxExpression minmax,
java.io.OutputStream stream)
public java.lang.String toString()
Expression
toString in class Expressionpublic boolean isMin()
public void setMin(boolean ismin)
ismin - true for MIN, false for MAXpublic void add(Expression e)
e - the new operand to be appendedpublic Expression negate()
public boolean isPosMax()
public boolean isNegMin()
public Expression simplify()
public int compareTo(Expression e)
compareTo in interface java.lang.Comparable<Expression>compareTo in class Expressionpublic java.lang.Integer compareTo(int num)
num - an integer value
public Expression toConditionalExpression()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||