@Test public void setChild() throws Exception { assertEquals("~ x", expr.getText()); expr.setChild(0, new VariableIdentifierExpr("y")); assertEquals("~ y", expr.getText()); }
@Override public void setChild(int index, Expr expr) { if (index == 0) { this.expr = expr; return; } throw new IndexOutOfBoundsException("Index for UnaryExpr must be 0"); }
UnaryExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { this.expr = expr; return; } throw new IndexOutOfBoundsException("Index for UnaryExpr must be 0"); } }
UnaryExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { this.expr = expr; return; } throw new IndexOutOfBoundsException("Index for UnaryExpr must be 0"); } UnaryExpr(Expr expr, UnOp op); }
UnaryExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { this.expr = expr; return; } throw new IndexOutOfBoundsException("Index for UnaryExpr must be 0"); } UnaryExpr(Expr expr, UnOp op); Expr getExpr(); UnOp getOp(); @Override void accept(IAstVisitor visitor); @Override UnaryExpr clone(); @Override boolean hasChild(IAstNode candidateChild); @Override Expr getChild(int index); @Override void setChild(int index, Expr expr); @Override int getNumChildren(); }
UnaryExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { this.expr = expr; return; } throw new IndexOutOfBoundsException("Index for UnaryExpr must be 0"); } UnaryExpr(Expr expr, UnOp op); Expr getExpr(); UnOp getOp(); @Override void accept(IAstVisitor visitor); @Override UnaryExpr clone(); @Override boolean hasChild(IAstNode candidateChild); @Override Expr getChild(int index); @Override void setChild(int index, Expr expr); @Override int getNumChildren();  }