|
|||||||||
| Home >> All >> openjava >> [ ptree overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
openjava.ptree
Class ConditionalExpression

java.lang.Objectopenjava.ptree.ParseTreeObject
openjava.ptree.NonLeaf
openjava.ptree.ConditionalExpression
- All Implemented Interfaces:
- java.lang.Cloneable, Expression, ParseTree, VariableInitializer
- public class ConditionalExpression
- extends NonLeaf
- implements Expression
- extends NonLeaf
The ConditionalExpression class represents
a conditional expression like:
(i == 1) ? 3 : 4
This consists of a conditional part, true case part, and false case part. Each part of them is an expression.
If the operator in the expression of the operands has week unity, this automatically produces the code in which the operands are enclosed by parenthesises.
In the case the conditional part is
f = f(),
the true case part is "red"
and the false case part is str = "blue"
this produces the code :
(f = f()) ? "red" : (str = "blue")
| Field Summary |
| Fields inherited from class openjava.ptree.NonLeaf |
|
| Fields inherited from class openjava.ptree.ParseTreeObject |
LN |
| Constructor Summary | |
(package private) |
ConditionalExpression()
|
|
ConditionalExpression(Expression condition,
Expression truecase,
Expression falsecase)
Allocates a new conditional expression object. |
| Method Summary | |
void |
accept(openjava.ptree.util.ParseTreeVisitor v)
Accepts a ParseTreeVisitor object as the role of a
Visitor in the Visitor pattern, as the role of an Element in the
Visitor pattern. |
Expression |
getCondition()
Gets the conditional part of this conditional expression. |
Expression |
getFalseCase()
Gets the false case part of this. |
Expression |
getTrueCase()
Gets the true case part of this conditional expression. |
openjava.mop.OJClass |
getType(openjava.mop.Environment env)
|
void |
setCondition(Expression expr)
Sets the conditional part of this conditional expression. |
void |
setFalseCase(Expression expr)
Sets the false case part of this. |
void |
setTrueCase(Expression expr)
Sets the true case part of this conditional expression. |
| Methods inherited from class openjava.ptree.NonLeaf |
childrenAccept, elementAt, equals, getComment, getContents, getLength, makeRecursiveCopy, replaceChildWith, set, set, set, set, set, set, set, set, set, setComment, setElementAt |
| Methods inherited from class openjava.ptree.ParseTreeObject |
clone, equal, getObjectID, getParent, hashCode, lastObjectID, makeCopy, replace, setParent, toFlattenString, toString |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface openjava.ptree.ParseTree |
childrenAccept, equals, getObjectID, makeCopy, makeRecursiveCopy, replace, toFlattenString, toString |
| Constructor Detail |
ConditionalExpression
public ConditionalExpression(Expression condition, Expression truecase, Expression falsecase)
- Allocates a new conditional expression object.
ConditionalExpression
ConditionalExpression()
| Method Detail |
getCondition
public Expression getCondition()
- Gets the conditional part of this conditional expression.
setCondition
public void setCondition(Expression expr)
- Sets the conditional part of this conditional expression.
getTrueCase
public Expression getTrueCase()
- Gets the true case part of this conditional expression.
setTrueCase
public void setTrueCase(Expression expr)
- Sets the true case part of this conditional expression.
getFalseCase
public Expression getFalseCase()
- Gets the false case part of this.
setFalseCase
public void setFalseCase(Expression expr)
- Sets the false case part of this.
accept
public void accept(openjava.ptree.util.ParseTreeVisitor v) throws ParseTreeException
- Description copied from interface:
ParseTree - Accepts a
ParseTreeVisitorobject as the role of a Visitor in the Visitor pattern, as the role of an Element in the Visitor pattern.This invoke an appropriate
visit()method on the accepted visitor.- Specified by:
acceptin interfaceParseTree- Specified by:
acceptin classParseTreeObject
getType
public openjava.mop.OJClass getType(openjava.mop.Environment env) throws java.lang.Exception
- Specified by:
getTypein interfaceExpression
|
|||||||||
| Home >> All >> openjava >> [ ptree overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC