/** * Returns the initializer expression. * * @return The initializer expression or <code>null<code> if <code>this * </code> represents an array initializer. */ public Expression getExpression() { if (mIsArrayInitializer) { return null; } if (mExpression == null) { mExpression = AST2Expression.resolveExpression( mInitializerTree, getTokenRewriteStream()); } return mExpression; }
/** * Returns the expression that belongs to the <code>throw</code> statement, * i.e. this is the expression that states or creates the object that should * be thrown. * * @return The expression that belongs to the <code>throw</code> statement. */ public Expression getExpression() { if (mExpression == null) { mExpression = AST2Expression.resolveExpression((AST2JSOMTree) getTreeNode().GetChild(0), getTokenRewriteStream()); } return mExpression; }
/** * Returns the expression for the cases where <code> * getAnnotationRValueType() == RValueType.EXPRESSION</code>. * * @return The expression or <code>null</code> if <code> * getAnnotationRValueType() != RValueType.EXPRESSION</code>. */ public Expression getExpression() { if (mRValueType != RValueType.EXPRESSION) { return null; } if (mExpression == null) { mExpression = AST2Expression.resolveExpression((AST2JSOMTree) getTreeNode(), getTokenRewriteStream()); } return mExpression; }
/** * Returns the </code>while</code> or <code>do...while</code> statement's * condition expression. * * @return The </code>while</code> or <code>do...while</code> statement's * condition expression. */ public Expression getCondition() { if (mCondition == null) { AST2JSOMTree tree = null; if (mIsWhileStatement) { tree = (AST2JSOMTree)getTreeNode().GetChild(0).GetChild(0); } else { tree = (AST2JSOMTree)getTreeNode().GetChild(1).GetChild(0); } mCondition = AST2Expression.resolveExpression( tree, getTokenRewriteStream()); } return mCondition; }
/** * Returns the expression of the <code>case<code> clause. * * @return The expression of the <code>case<code> clause or <code>null * </code> if <code>this</code> is actually a <code>default * </code> clause. */ public Expression getExpression() { if (mIsDefaultClause) { return null; } if (mCaseExpression == null) { mCaseExpression = AST2Expression.resolveExpression((AST2JSOMTree) getTreeNode().GetChild(0), getTokenRewriteStream()); } return mCaseExpression; }
/** * Returns the <code>for</code> statement's condition expression. * * @return The <code>for</code> statement's condition expression or <code> * null</code> if no condition expression has been stated. */ public Expression getForCondition() { if (!mHasForCondition) { return null; // There's no condition expression. } if (mConditionExpression == null) { mConditionExpression = AST2Expression.resolveExpression((AST2JSOMTree) getTreeNode().GetChild(1).GetChild(0), getTokenRewriteStream()); } return mConditionExpression; }
/** * Returns the expression that follows the <code>return</code> keyword. * * @return The expression that follows the <code>return</code> statement * or <code>null</code> if the return statement belongs to a void * method's scope. */ public Expression getExpression() { if (!mHasExpression) { return null; // No expression available. } if (mExpression == null) { mExpression = AST2Expression.resolveExpression((AST2JSOMTree) getTreeNode().GetChild(0), getTokenRewriteStream()); } return mExpression; }