class JjBinary_c extends Binary_c {

  public JjBinary_c(Position pos, Expr left, Binary.Operator op, Expr right) {
    super(pos, left, op, right);
  }

  public Type childExpectedType(Expr child, AscriptionVisitor av) {<FILL_FUNCTION_BODY>}

  /*
   * public Node foldConstants(ConstantFolder cf) { if (left instanceof Binary || left instanceof Field){ left =
   * left.del.foldConstants(cf); } if (right instanceof Binary || right instanceof Field){ right =
   * right.del.foldConstants(cf); } if (left instanceof StringLit && right instanceof StringLit) { String l = ((StringLit)
   * left).value(); String r = ((StringLit) right).value(); if (op == ADD) return nf.StringLit(position(), l + r); } else if
   * (left instanceof }
   */
}

    Expr other;

    // System.out.println("child: "+child+" op: "+op);
    if (child == left) {
      other = right;
    } else if (child == right) {
      other = left;
    } else {
      return child.type();
    }

    TypeSystem ts = av.typeSystem();

    if (op == EQ || op == NE) {
      // Coercion to compatible types.
      if (other.type().isReference() || other.type().isNull()) {
        return ts.Object();
      }

      if (other.type().isBoolean()) {
        return ts.Boolean();
      }

      if (other.type().isNumeric()) {
        if (other.type().isDouble() || child.type().isDouble()) {
          return ts.Double();
        } else if (other.type().isFloat() || child.type().isFloat()) {
          return ts.Float();
        } else if (other.type().isLong() || child.type().isLong()) {
          return ts.Long();
        } else {
          return ts.Int();
        }
      }
    }

    if (op == ADD && ts.equals(type, ts.String())) {
      // Implicit coercion to String.
      return ts.String();
    }

    if (op == GT || op == LT || op == GE || op == LE) {
      if (other.type().isBoolean()) {
        return ts.Boolean();
      }
      if (other.type().isNumeric()) {
        if (other.type().isDouble() || child.type().isDouble()) {
          return ts.Double();
        } else if (other.type().isFloat() || child.type().isFloat()) {
          return ts.Float();
        } else if (other.type().isLong() || child.type().isLong()) {
          return ts.Long();
        } else {
          return ts.Int();
        }
      }
    }

    if (op == COND_OR || op == COND_AND) {
      return ts.Boolean();
    }

    if (op == BIT_AND || op == BIT_OR || op == BIT_XOR) {
      if (other.type().isBoolean()) {
        return ts.Boolean();
      }
      if (other.type().isNumeric()) {
        if (other.type().isLong() || child.type().isLong()) {
          return ts.Long();
        } else {
          return ts.Int();
        }
      }
    }

    if (op == ADD || op == SUB || op == MUL || op == DIV || op == MOD) {
      // System.out.println("other: "+other+" type: "+other.type());
      // System.out.println("child: "+child+" child: "+child.type());

      if (other.type().isNumeric()) {
        if (other.type().isDouble() || child.type().isDouble()) {
          return ts.Double();
        } else if (other.type().isFloat() || child.type().isFloat()) {
          return ts.Float();
        } else if (other.type().isLong() || child.type().isLong()) {
          return ts.Long();
        } else {
          return ts.Int();
        }
      }
    }

    if (op == SHL || op == SHR || op == USHR) {
      if (child == right || !child.type().isLong()) {
        return ts.Int();
      } else {
        return child.type();
      }
    }

    return child.type();

  
<methods>public void <init>(polyglot.util.Position, polyglot.ast.Expr, polyglot.ast.Binary.Operator, polyglot.ast.Expr) ,public List#RAW acceptCFG(polyglot.visit.CFGBuilder, List#RAW) ,public polyglot.types.Type childExpectedType(polyglot.ast.Expr, polyglot.visit.AscriptionVisitor) ,public java.lang.Object constantValue() ,public void dump(polyglot.util.CodeWriter) ,public polyglot.ast.Term entry() ,public boolean isConstant() ,public polyglot.ast.Expr left() ,public polyglot.ast.Binary left(polyglot.ast.Expr) ,public polyglot.ast.Binary.Operator operator() ,public polyglot.ast.Binary operator(polyglot.ast.Binary.Operator) ,public polyglot.ast.Precedence precedence() ,public polyglot.ast.Binary precedence(polyglot.ast.Precedence) ,public void prettyPrint(polyglot.util.CodeWriter, polyglot.visit.PrettyPrinter) ,public polyglot.ast.Expr right() ,public polyglot.ast.Binary right(polyglot.ast.Expr) ,public List#RAW throwTypes(polyglot.types.TypeSystem) ,public boolean throwsArithmeticException() ,public java.lang.String toString() ,public polyglot.ast.Node typeCheck(polyglot.visit.TypeChecker) throws polyglot.types.SemanticException,public polyglot.ast.Node visitChildren(polyglot.visit.NodeVisitor) <variables>protected polyglot.ast.Expr left,protected polyglot.ast.Binary.Operator op,protected polyglot.ast.Precedence precedence,protected polyglot.ast.Expr right