@Test(expected = IndexOutOfBoundsException.class) public void setChildBad() { makeTernary().setChild(3, conditionVar); }
@Override public void setChild(int index, Expr expr) { if (index == 0) { test = expr; return; } if (index == 1) { thenExpr = expr; return; } if (index == 2) { elseExpr = expr; return; } throw new IndexOutOfBoundsException("Index for TernaryExpr must be 0, 1 or 2"); }
TernaryExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { test = expr; return; } if (index == 1) { thenExpr = expr; return; } if (index == 2) { elseExpr = expr; return; } throw new IndexOutOfBoundsException("Index for TernaryExpr must be 0, 1 or 2"); } }
TernaryExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { test = expr; return; } if (index == 1) { thenExpr = expr; return; } if (index == 2) { elseExpr = expr; return; } throw new IndexOutOfBoundsException("Index for TernaryExpr must be 0, 1 or 2"); } TernaryExpr(Expr test, Expr thenExpr, Expr elseExpr); }
TernaryExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { test = expr; return; } if (index == 1) { thenExpr = expr; return; } if (index == 2) { elseExpr = expr; return; } throw new IndexOutOfBoundsException("Index for TernaryExpr must be 0, 1 or 2"); } TernaryExpr(Expr test, Expr thenExpr, Expr elseExpr); Expr getTest(); Expr getThenExpr(); Expr getElseExpr(); @Override void accept(IAstVisitor visitor); @Override TernaryExpr clone(); @Override boolean hasChild(IAstNode candidateChild); @Override Expr getChild(int index); @Override void setChild(int index, Expr expr); @Override int getNumChildren(); }
TernaryExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { test = expr; return; } if (index == 1) { thenExpr = expr; return; } if (index == 2) { elseExpr = expr; return; } throw new IndexOutOfBoundsException("Index for TernaryExpr must be 0, 1 or 2"); } TernaryExpr(Expr test, Expr thenExpr, Expr elseExpr); Expr getTest(); Expr getThenExpr(); Expr getElseExpr(); @Override void accept(IAstVisitor visitor); @Override TernaryExpr clone(); @Override boolean hasChild(IAstNode candidateChild); @Override Expr getChild(int index); @Override void setChild(int index, Expr expr); @Override int getNumChildren();  }