public void addIndex(Expression expr) { if (expr.getParent() != null) throw new NotAnOrphanException(); children.add(expr); expr.setParent(this); }
/** * Sets the nth index expression of this array access. * * @param n The position of the index expression. * @param expr The expression to use for the index. * @throws IndexOutOfBoundsException if there is no expression at that position. */ public void setIndex(int n, Expression expr) { if (expr.getParent() != null) throw new NotAnOrphanException(); children.set(n + 1, expr); expr.setParent(this); }