jparse.expr
Class ConditionalAST

java.lang.Object
  extended byantlr.BaseAST
      extended byantlr.CommonAST
          extended byantlr.CommonASTWithHiddenTokens
              extended byjparse.JavaAST
                  extended byjparse.expr.ExpressionAST
                      extended byjparse.expr.ConditionalAST
All Implemented Interfaces:
antlr.collections.AST, HasExceptions, Serializable

public final class ConditionalAST
extends ExpressionAST

An AST node that represents a conditional expression

Author:
Jerry James
See Also:
Serialized Form

Field Summary
private  ExpressionAST conditionPart
          The "condition" part of the conditional
private  ExpressionAST elsePart
          The "else" part of the conditional
private  ExpressionAST thenPart
          The "then" part of the conditional
 
Fields inherited from class jparse.expr.ExpressionAST
exceptions, nonconstant, type, value
 
Fields inherited from class jparse.JavaAST
context, currSymTable, noTypes, symTable, topLevel, typeAST
 
Fields inherited from class antlr.CommonASTWithHiddenTokens
hiddenAfter, hiddenBefore
 
Fields inherited from class antlr.CommonAST
 
Fields inherited from class antlr.BaseAST
down, right
 
Constructor Summary
ConditionalAST(antlr.Token token)
          Create a new conditional expression AST
 
Method Summary
protected  Type[] computeExceptions()
          Compute the checked exception types that might be thrown by this expression
protected  Type computeType()
          Compute the type of this expression
protected  Object computeValue()
          Compute the constant value of this expression, if any
 ExpressionAST getCondition()
          Get the condition part of this conditional expression
 ExpressionAST getElse()
          Get the else part of this conditional expression
 ExpressionAST getThen()
          Get the then part of this conditional expression
 VarList getVarList()
          Get the list of variables read and written by this expression
 void parseComplete()
          Compute any derived attributes that must be evaluated after the initial parse.
 
Methods inherited from class jparse.expr.ExpressionAST
getExceptionTypes, getValue, retrieveType
 
Methods inherited from class jparse.JavaAST
print, printHiddenAfter, printHiddenBefore
 
Methods inherited from class antlr.CommonASTWithHiddenTokens
getHiddenAfter, getHiddenBefore, initialize
 
Methods inherited from class antlr.CommonAST
getText, getType, initialize, initialize, setText, setType
 
Methods inherited from class antlr.BaseAST
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getColumn, getFirstChild, getLine, getNextSibling, getNumberOfChildren, getTokenNames, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toString, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

conditionPart

private ExpressionAST conditionPart
The "condition" part of the conditional


thenPart

private ExpressionAST thenPart
The "then" part of the conditional


elsePart

private ExpressionAST elsePart
The "else" part of the conditional

Constructor Detail

ConditionalAST

public ConditionalAST(antlr.Token token)
Create a new conditional expression AST

Parameters:
token - the token represented by this AST node
Method Detail

parseComplete

public void parseComplete()
Description copied from class: JavaAST
Compute any derived attributes that must be evaluated after the initial parse. The default action is to just tell your children that the parse is complete.

Overrides:
parseComplete in class JavaAST

computeType

protected Type computeType()
Description copied from class: ExpressionAST
Compute the type of this expression

Specified by:
computeType in class ExpressionAST
Returns:
the type of this expression

computeExceptions

protected Type[] computeExceptions()
Description copied from class: ExpressionAST
Compute the checked exception types that might be thrown by this expression

Specified by:
computeExceptions in class ExpressionAST
Returns:
an array of types representing the exceptions that this expression might throw

computeValue

protected Object computeValue()
Description copied from class: ExpressionAST
Compute the constant value of this expression, if any

Specified by:
computeValue in class ExpressionAST
Returns:
the constant value (if any) of this expression, as a wrapped primitive type or an object type

getVarList

public VarList getVarList()
Description copied from class: ExpressionAST
Get the list of variables read and written by this expression

Specified by:
getVarList in class ExpressionAST
Returns:
the list of variables read and written by this expression

getCondition

public ExpressionAST getCondition()
Get the condition part of this conditional expression

Returns:
the condition part of the expression

getThen

public ExpressionAST getThen()
Get the then part of this conditional expression

Returns:
the then of the expression

getElse

public ExpressionAST getElse()
Get the else part of this conditional expression

Returns:
the else part of the expression