/** * Inserts the given node into the list at the given index. * The index corresponds to a combined list of original and new nodes; * removed or replaced nodes are still in the combined list. * The inserted node must either be brand new (not part of the original AST) * or a placeholder node (for example, one created by * {@link ASTRewrite#createCopyTarget(ASTNode)}, * {@link ASTRewrite#createMoveTarget(ASTNode)}, * or {@link ASTRewrite#createStringPlaceholder(String, int)}). The AST itself * is not actually modified in any way; rather, the rewriter just records * a note that this node has been inserted into the list. * * @param node the node to insert * @param index insertion index in the combined list of original and * inserted nodes; <code>-1</code> indicates insertion as the last element * @param editGroup the edit group in which to collect the corresponding * text edits, or <code>null</code> if ungrouped * @throws IllegalArgumentException if the node is null, or if the node is not part * of this rewriter's AST, or if the inserted node is not a new node (or * placeholder), or if the described modification is otherwise invalid * (not a member of this node's original list) * @throws IndexOutOfBoundsException if the index is negative and not -1, * or if it is larger than the size of the combined list */ public void insertAt(ASTNode node, int index, TextEditGroup editGroup) { if (node == null) { throw new IllegalArgumentException(); } internalInsertAt(node, index, isInsertBoundToPreviousByDefault(node), editGroup); }
/** * Inserts the given node into the list at the given index. * The index corresponds to a combined list of original and new nodes; * removed or replaced nodes are still in the combined list. * The inserted node must either be brand new (not part of the original AST) * or a placeholder node (for example, one created by * {@link ASTRewrite#createCopyTarget(ASTNode)}, * {@link ASTRewrite#createMoveTarget(ASTNode)}, * or {@link ASTRewrite#createStringPlaceholder(String, int)}). The AST itself * is not actually modified in any way; rather, the rewriter just records * a note that this node has been inserted into the list. * * @param node the node to insert * @param index insertion index in the combined list of original and * inserted nodes; <code>-1</code> indicates insertion as the last element * @param editGroup the edit group in which to collect the corresponding * text edits, or <code>null</code> if ungrouped * @throws IllegalArgumentException if the node is null, or if the node is not part * of this rewriter's AST, or if the inserted node is not a new node (or * placeholder), or if the described modification is otherwise invalid * (not a member of this node's original list) * @throws IndexOutOfBoundsException if the index is negative and not -1, * or if it is larger than the size of the combined list */ public void insertAt(ASTNode node, int index, TextEditGroup editGroup) { if (node == null) { throw new IllegalArgumentException(); } internalInsertAt(node, index, isInsertBoundToPreviousByDefault(node), editGroup); }
/** * Inserts the given node into the list at the given index. * The index corresponds to a combined list of original and new nodes; * removed or replaced nodes are still in the combined list. * The inserted node must either be brand new (not part of the original AST) * or a placeholder node (for example, one created by * {@link ASTRewrite#createCopyTarget(ASTNode)}, * {@link ASTRewrite#createMoveTarget(ASTNode)}, * or {@link ASTRewrite#createStringPlaceholder(String, int)}). The AST itself * is not actually modified in any way; rather, the rewriter just records * a note that this node has been inserted into the list. * * @param node the node to insert * @param index insertion index in the combined list of original and * inserted nodes; <code>-1</code> indicates insertion as the last element * @param editGroup the edit group in which to collect the corresponding * text edits, or <code>null</code> if ungrouped * @throws IllegalArgumentException if the node is null, or if the node is not part * of this rewriter's AST, or if the inserted node is not a new node (or * placeholder), or if the described modification is otherwise invalid * (not a member of this node's original list) * @throws IndexOutOfBoundsException if the index is negative and not -1, * or if it is larger than the size of the combined list */ public void insertAt(ASTNode node, int index, TextEditGroup editGroup) { if (node == null) { throw new IllegalArgumentException(); } internalInsertAt(node, index, isInsertBoundToPreviousByDefault(node), editGroup); }
/** * Inserts the given node into the list at the given index. * The index corresponds to a combined list of original and new nodes; * removed or replaced nodes are still in the combined list. * The inserted node must either be brand new (not part of the original AST) * or a placeholder node (for example, one created by * {@link ASTRewrite#createCopyTarget(ASTNode)}, * {@link ASTRewrite#createMoveTarget(ASTNode)}, * or {@link ASTRewrite#createStringPlaceholder(String, int)}). The AST itself * is not actually modified in any way; rather, the rewriter just records * a note that this node has been inserted into the list. * * @param node the node to insert * @param index insertion index in the combined list of original and * inserted nodes; <code>-1</code> indicates insertion as the last element * @param editGroup the edit group in which to collect the corresponding * text edits, or <code>null</code> if ungrouped * @throws IllegalArgumentException if the node is null, or if the node is not part * of this rewriter's AST, or if the inserted node is not a new node (or * placeholder), or if the described modification is otherwise invalid * (not a member of this node's original list) * @throws IndexOutOfBoundsException if the index is negative and not -1, * or if it is larger than the size of the combined list */ public void insertAt(ASTNode node, int index, TextEditGroup editGroup) { if (node == null) { throw new IllegalArgumentException(); } internalInsertAt(node, index, isInsertBoundToPreviousByDefault(node), editGroup); }
/** * Inserts the given node into the list at the given index. * The index corresponds to a combined list of original and new nodes; * removed or replaced nodes are still in the combined list. * The inserted node must either be brand new (not part of the original AST) * or a placeholder node (for example, one created by * {@link ASTRewrite#createCopyTarget(ASTNode)}, * {@link ASTRewrite#createMoveTarget(ASTNode)}, * or {@link ASTRewrite#createStringPlaceholder(String, int)}). The AST itself * is not actually modified in any way; rather, the rewriter just records * a note that this node has been inserted into the list. * * @param node the node to insert * @param index insertion index in the combined list of original and * inserted nodes; <code>-1</code> indicates insertion as the last element * @param editGroup the edit group in which to collect the corresponding * text edits, or <code>null</code> if ungrouped * @throws IllegalArgumentException if the node is null, or if the node is not part * of this rewriter's AST, or if the inserted node is not a new node (or * placeholder), or if the described modification is otherwise invalid * (not a member of this node's original list) * @throws IndexOutOfBoundsException if the index is negative and not -1, * or if it is larger than the size of the combined list */ public void insertAt(ASTNode node, int index, TextEditGroup editGroup) { if (node == null) { throw new IllegalArgumentException(); } internalInsertAt(node, index, isInsertBoundToPreviousByDefault(node), editGroup); }
/** * Inserts the given node into the list at the given index. * The index corresponds to a combined list of original and new nodes; * removed or replaced nodes are still in the combined list. * The inserted node must either be brand new (not part of the original AST) * or a placeholder node (for example, one created by * {@link ASTRewrite#createCopyTarget(ASTNode)}, * {@link ASTRewrite#createMoveTarget(ASTNode)}, * or {@link ASTRewrite#createStringPlaceholder(String, int)}). The AST itself * is not actually modified in any way; rather, the rewriter just records * a note that this node has been inserted into the list. * * @param node the node to insert * @param index insertion index in the combined list of original and * inserted nodes; <code>-1</code> indicates insertion as the last element * @param editGroup the edit group in which to collect the corresponding * text edits, or <code>null</code> if ungrouped * @throws IllegalArgumentException if the node is null, or if the node is not part * of this rewriter's AST, or if the inserted node is not a new node (or * placeholder), or if the described modification is otherwise invalid * (not a member of this node's original list) * @throws IndexOutOfBoundsException if the index is negative and not -1, * or if it is larger than the size of the combined list */ public void insertAt(ASTNode node, int index, TextEditGroup editGroup) { if (node == null) { throw new IllegalArgumentException(); } internalInsertAt(node, index, isInsertBoundToPreviousByDefault(node), editGroup); }