@Test(expected = IndexOutOfBoundsException.class) public void setChildBad() { expr.setChild(-1, new VariableIdentifierExpr("T")); }
@Override public void setChild(int index, Expr expr) { if (index == 0) { array = expr; return; } if (index == 1) { this.index = expr; return; } throw new IndexOutOfBoundsException("Index for ArrayIndexExpr must be 0 or 1"); }
ArrayIndexExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { array = expr; return; } if (index == 1) { this.index = expr; return; } throw new IndexOutOfBoundsException("Index for ArrayIndexExpr must be 0 or 1"); } }
ArrayIndexExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { array = expr; return; } if (index == 1) { this.index = expr; return; } throw new IndexOutOfBoundsException("Index for ArrayIndexExpr must be 0 or 1"); } ArrayIndexExpr(Expr array, Expr index); }
ArrayIndexExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { array = expr; return; } if (index == 1) { this.index = expr; return; } throw new IndexOutOfBoundsException("Index for ArrayIndexExpr must be 0 or 1"); } ArrayIndexExpr(Expr array, Expr index); Expr getArray(); Expr getIndex(); void setIndex(Expr index); @Override void accept(IAstVisitor visitor); @Override ArrayIndexExpr clone(); @Override boolean hasChild(IAstNode candidateChild); @Override Expr getChild(int index); @Override void setChild(int index, Expr expr); @Override int getNumChildren(); }
ArrayIndexExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { array = expr; return; } if (index == 1) { this.index = expr; return; } throw new IndexOutOfBoundsException("Index for ArrayIndexExpr must be 0 or 1"); } ArrayIndexExpr(Expr array, Expr index); Expr getArray(); Expr getIndex(); void setIndex(Expr index); @Override void accept(IAstVisitor visitor); @Override ArrayIndexExpr clone(); @Override boolean hasChild(IAstNode candidateChild); @Override Expr getChild(int index); @Override void setChild(int index, Expr expr); @Override int getNumChildren();  }