Ejemplo n.º 1
0
 /**
  * Returns a copy of the provided nodes list.
  *
  * @param <T> the actual nodes's type
  * @param nodes the nodes list to copy
  * @return a single node, representing a copy of the nodes list
  */
 public <T extends ASTNode> T copyRange(List<T> nodes) {
   if (nodes.isEmpty()) {
     return null;
   }
   if (!isValidForRangeCopy(nodes)) {
     throw new IllegalArgumentException(
         nodes.get(0), "The provided nodes are not valid for doing a range copy: " + nodes);
   }
   return refactorings.createCopyTarget(nodes.get(0), nodes.get(nodes.size() - 1));
 }
Ejemplo n.º 2
0
 /**
  * Returns a copy of the provided {@link ASTNode}.
  *
  * @param <T> the actual node type
  * @param nodeToCopy the node to copy
  * @return a copy of the node
  */
 public <T extends ASTNode> T copy(T nodeToCopy) {
   if (isValidInCurrentAST(nodeToCopy)) {
     return refactorings.createCopyTarget(nodeToCopy);
   }
   return copySubtree(nodeToCopy);
 }