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

java.lang.Objectopenjava.ptree.ParseTreeObject
openjava.ptree.NonLeaf
openjava.ptree.UnaryExpression
- All Implemented Interfaces:
- java.lang.Cloneable, Expression, ParseTree, VariableInitializer
- public class UnaryExpression
- extends NonLeaf
- implements Expression
- extends NonLeaf
The UnaryExpression class presents for an expression which
consists of unary operator with one Expression.
The unary expressions are :
expr++,expr--,++expr,--expr,^expr,!expr,+expror-expr
,where
expr is an expression.
If the operator in the expression of the operand has week unity,
this automatically produces the code in which the operand
is enclosed by parenthesises.
In the case the operand is y = x and
the urary operator is +,
this produces the code :
+(y = x)
Field Summary
static int
BIT_NOT
Post increment operator like:
static int
MINUS
Post increment operator like:
static int
NOT
Post increment operator like:
private int
opr
operator
private static java.lang.String[]
opr_string
static int
PLUS
Post increment operator like:
static int
POST_DECREMENT
Post decrement operator like:
static int
POST_INCREMENT
Post increment operator like:
static int
PRE_DECREMENT
Post increment operator like:
static int
PRE_INCREMENT
Pre increment operator like:
Fields inherited from class openjava.ptree.NonLeaf
Fields inherited from class openjava.ptree.ParseTreeObject
LN
Constructor Summary
(package private)
UnaryExpression()
UnaryExpression(Expression expr,
int opr)
Allocates a new object.
UnaryExpression(int opr,
Expression expr)
Allocates a new 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
getExpression()
Gets the expression operated in this expression.
int
getOperator()
Gets the operator of this unary expression.
openjava.mop.OJClass
getType(openjava.mop.Environment env)
boolean
isPostfix()
Tests if the operator of unary expression is a postfix operator.
boolean
isPrefix()
Tests if the operator of unary expression is a prefix operator.
ParseTree
makeCopy()
Makes a new copy of this nonleaf-node as a ptree-node.
ParseTree
makeRecursiveCopy()
Makes a new copy (another object) of this nonleaf-node recursively.
java.lang.String
operatorString()
void
setExpression(Expression expr)
Sets the expression operated in this expression.
void
setOperator(int opr)
Sets the operator of this unary expression.
Methods inherited from class openjava.ptree.NonLeaf
childrenAccept, elementAt, equals, getComment, getContents, getLength, 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, 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, replace, toFlattenString, toString
Field Detail
POST_INCREMENT
public static final int POST_INCREMENT
- Post increment operator like:
i++
- See Also:
- Constant Field Values
POST_DECREMENT
public static final int POST_DECREMENT
- Post decrement operator like:
i--
- See Also:
- Constant Field Values
PRE_INCREMENT
public static final int PRE_INCREMENT
- Pre increment operator like:
++i
- See Also:
- Constant Field Values
PRE_DECREMENT
public static final int PRE_DECREMENT
- Post increment operator like:
--i
- See Also:
- Constant Field Values
BIT_NOT
public static final int BIT_NOT
- Post increment operator like:
~i
- See Also:
- Constant Field Values
NOT
public static final int NOT
- Post increment operator like:
! c
- See Also:
- Constant Field Values
PLUS
public static final int PLUS
- Post increment operator like:
+i
- See Also:
- Constant Field Values
MINUS
public static final int MINUS
- Post increment operator like:
-i
- See Also:
- Constant Field Values
opr_string
private static final java.lang.String[] opr_string
opr
private int opr
- operator
Constructor Detail
UnaryExpression
public UnaryExpression(int opr,
Expression expr)
- Allocates a new object.
UnaryExpression
public UnaryExpression(Expression expr,
int opr)
- Allocates a new object.
UnaryExpression
UnaryExpression()
Method Detail
makeRecursiveCopy
public ParseTree makeRecursiveCopy()
- Description copied from interface:
ParseTree
- Makes a new copy (another object) of this nonleaf-node recursively.
The objects contained by this object will also be copied.
- Specified by:
makeRecursiveCopy in interface ParseTree- Overrides:
makeRecursiveCopy in class NonLeaf
makeCopy
public ParseTree makeCopy()
- Description copied from interface:
ParseTree
- Makes a new copy of this nonleaf-node as a ptree-node.
The objects contained by the new object are same as
these contained by the original object.
- Specified by:
makeCopy in interface ParseTree- Overrides:
makeCopy in class ParseTreeObject
getExpression
public Expression getExpression()
- Gets the expression operated in this expression.
setExpression
public void setExpression(Expression expr)
- Sets the expression operated in this expression.
getOperator
public int getOperator()
- Gets the operator of this unary expression.
setOperator
public void setOperator(int opr)
- Sets the operator of this unary expression.
isPostfix
public boolean isPostfix()
- Tests if the operator of unary expression is a postfix operator.
isPrefix
public boolean isPrefix()
- Tests if the operator of unary expression is a prefix operator.
operatorString
public java.lang.String operatorString()
accept
public void accept(openjava.ptree.util.ParseTreeVisitor v)
throws ParseTreeException
- Description copied from interface:
ParseTree
- Accepts a
ParseTreeVisitor object 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:
accept in interface ParseTree- Specified by:
accept in class ParseTreeObject
getType
public openjava.mop.OJClass getType(openjava.mop.Environment env)
throws java.lang.Exception
- Specified by:
getType in interface Expression
Overview
Package
Class
Use
Deprecated
Index
Home >> All >> openjava >> [ ptree overview ]
PREV CLASS NEXT CLASS
SUMMARY:
JAVADOC |
SOURCE |
DOWNLOAD | NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
