/*
  * @see ASTVisitor#visit(ConditionalExpression)
  */
 public boolean visit(ConditionalExpression node) {
   node.getExpression().accept(this);
   this.fBuffer.append("?"); // $NON-NLS-1$
   node.getThenExpression().accept(this);
   this.fBuffer.append(":"); // $NON-NLS-1$
   node.getElseExpression().accept(this);
   return false;
 }
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ConditionalExpression)
  */
 public boolean visit(ConditionalExpression node) {
   PTConditionalExpression ce = InstantiationFactory.eINSTANCE.createPTConditionalExpression();
   ce.setCondition(perform(node.getExpression()));
   ce.setTrue(perform(node.getThenExpression()));
   ce.setFalse(perform(node.getElseExpression()));
   expression = ce;
   return false;
 }
  private void collectSideEffects(Expression expr, List<Expression> sideEffectExprs) {
    // local variable, parameter, enum constant, etc.
    // OR method starting with is*(), get*()
    // except atomic long, atomic integer, etc.
    switch (expr.getNodeType()) {
      case METHOD_INVOCATION:
        MethodInvocation mi = (MethodInvocation) expr;
        methodHasSideEffects(mi.resolveMethodBinding(), mi, sideEffectExprs);
        collectSideEffects(mi.getExpression(), sideEffectExprs);
        collectSideEffects(arguments(mi), sideEffectExprs);
        break;

      case SUPER_METHOD_INVOCATION:
        SuperMethodInvocation smi = (SuperMethodInvocation) expr;
        methodHasSideEffects(smi.resolveMethodBinding(), smi, sideEffectExprs);
        collectSideEffects(arguments(smi), sideEffectExprs);
        break;

      case CLASS_INSTANCE_CREATION:
        ClassInstanceCreation cic = (ClassInstanceCreation) expr;
        methodHasSideEffects(cic.resolveConstructorBinding(), cic, sideEffectExprs);
        collectSideEffects(cic.getExpression(), sideEffectExprs);
        collectSideEffects(arguments(cic), sideEffectExprs);
        break;

      case ARRAY_ACCESS:
        ArrayAccess aa = (ArrayAccess) expr;
        collectSideEffects(aa.getArray(), sideEffectExprs);
        collectSideEffects(aa.getIndex(), sideEffectExprs);
        break;
      case ARRAY_CREATION:
        ArrayCreation ac = (ArrayCreation) expr;
        collectSideEffects(ac.getInitializer(), sideEffectExprs);
        collectSideEffects(ac.dimensions(), sideEffectExprs);
        break;
      case ARRAY_INITIALIZER:
        ArrayInitializer ai = (ArrayInitializer) expr;
        collectSideEffects(expressions(ai), sideEffectExprs);
        break;
      case ASSIGNMENT:
        Assignment as = (Assignment) expr;
        collectSideEffects(as.getLeftHandSide(), sideEffectExprs);
        collectSideEffects(as.getRightHandSide(), sideEffectExprs);
        break;

      case CONDITIONAL_EXPRESSION:
        ConditionalExpression ce = (ConditionalExpression) expr;
        collectSideEffects(ce.getExpression(), sideEffectExprs);
        collectSideEffects(ce.getThenExpression(), sideEffectExprs);
        collectSideEffects(ce.getElseExpression(), sideEffectExprs);
        break;

      case FIELD_ACCESS:
        FieldAccess fa = (FieldAccess) expr;
        collectSideEffects(fa.getExpression(), sideEffectExprs);
        collectSideEffects(fa.getName(), sideEffectExprs);
        break;
      case SUPER_FIELD_ACCESS:
        SuperFieldAccess sfa = (SuperFieldAccess) expr;
        collectSideEffects(sfa.getQualifier(), sideEffectExprs);
        collectSideEffects(sfa.getName(), sideEffectExprs);
        break;
      case THIS_EXPRESSION:
        collectSideEffects(((ThisExpression) expr).getQualifier(), sideEffectExprs);
        break;
      case VARIABLE_DECLARATION_EXPRESSION:
        collectSideEffects((VariableDeclarationExpression) expr, sideEffectExprs);
        break;

      case INFIX_EXPRESSION:
        InfixExpression ie = (InfixExpression) expr;
        collectSideEffects(ie.getLeftOperand(), sideEffectExprs);
        collectSideEffects(ie.getRightOperand(), sideEffectExprs);
        collectSideEffects(extendedOperands(ie), sideEffectExprs);
        break;

      case CAST_EXPRESSION:
        collectSideEffects(((CastExpression) expr).getExpression(), sideEffectExprs);
        break;
      case INSTANCEOF_EXPRESSION:
        collectSideEffects(((InstanceofExpression) expr).getLeftOperand(), sideEffectExprs);
        break;
      case PARENTHESIZED_EXPRESSION:
        collectSideEffects(((ParenthesizedExpression) expr).getExpression(), sideEffectExprs);
        break;
      case POSTFIX_EXPRESSION:
        sideEffectExprs.add(expr);
        break;
      case PREFIX_EXPRESSION:
        PrefixExpression pe = (PrefixExpression) expr;
        PrefixExpression.Operator op = pe.getOperator();
        if (PrefixExpression.Operator.INCREMENT.equals(op)
            | PrefixExpression.Operator.DECREMENT.equals(op)) {
          sideEffectExprs.add(pe);
        } else {
          collectSideEffects(pe.getOperand(), sideEffectExprs);
        }
        break;

      default:
        // literals
        // names
    }
  }