// Path: asteroid-core/src/main/java/asteroid/A.java
// @SuppressWarnings("PMD.ShortClassName")
// public final class A {
// 
//     /**
//      * Entry point to get node builders.
//      *
//      * @since 0.1.0
//      */
//     public static final Nodes NODES = new Nodes();
// 
//     /**
//      * Entry point to access language modifiers
//      *
//      * @since 0.1.0
//      */
//     public static final Modifiers ACC = new Modifiers();
// 
//     /**
//      * Entry point to create statements.
//      *
//      * @since 0.1.0
//      */
//     public static final Statements STMT = new Statements();
// 
//     /**
//      * Entry point to create expressions
//      *
//      * @since 0.1.0
//      */
//     public static final Expressions EXPR = new Expressions();
// 
//     /**
//      * Entry point to get util functions
//      *
//      * @since 0.1.0
//      */
//     public static final Utils UTIL = new Utils();
// 
//     /**
//      * Entry point to get criterias
//      *
//      * @since 0.2.4
//      */
//     public static final Criterias CRITERIA = new Criterias();
// }
// 
// Path: asteroid-core/src/main/java/asteroid/utils/StatementUtils.java
// @SuppressWarnings("PMD.BeanMembersShouldSerialize")
// public static class Group {
//     public final Label label;
//     public final List<Statement> statements;
// 
//     /**
//      * Default constructor
//      *
//      * @param label the label identifying this group
//      * @param statements the statements that belong to this group
//      */
//     Group(final Label label, final List<Statement> statements) {
//         this.label      = label;
//         this.statements = statements;
//     }
// 
//     /**
//      * Utility method to clone a given {@link Group} changing the statement list
//      *
//      * @param newStatements the new statements of the group
//      * @return a new {@link Group}
//      */
//     public Group copyWithStatements(final List<Statement> newStatements) {
//         return new Group(new Label(label.name, label.expression), newStatements);
//     }
// }
// 
// Path: asteroid-core/src/main/java/asteroid/nodes/AnnotationNodeBuilder.java
// final public class AnnotationNodeBuilder {
// 
//     private final AnnotationNode annotationNode;
// 
//     private AnnotationNodeBuilder(final AnnotationNode annotationNode) {
//         this.annotationNode = annotationNode;
//     }
// 
//     /**
//      * Creates an instance of {@link AnnotationNodeBuilder}
//      * <br><br>
//      *
//      * <strong>AST</strong>
//      * <pre><code>annotation(MyAnnotation.class).build()</code></pre>
//      *
//      * <strong>Result</strong>
//      * <pre><code>@MyAnnotation</code></pre>
//      *
//      * @param clazz the annotation type
//      * @return an instance of {@link AnnotationNodeBuilder}
//      */
//     public static AnnotationNodeBuilder annotation(final Class clazz) {
//         return new AnnotationNodeBuilder(new AnnotationNode(A.NODES.clazz(clazz).build()));
//     }
// 
//     /**
//      * Adds a new member to the annotation
//      * <br><br>
//      *
//      * <strong>AST</strong>
//      * <pre><code>annotation(MyAnnotation.class)
//      * .member('value', classX(String.class))
//      * .build()</code></pre>
//      *
//      * <strong>Result</strong>
//      * <pre><code>@MyAnnotation(String.class)</code></pre>
//      *
//      * @param name the name of the new member
//      * @param expression the  value of the new member. It could be {@link org.codehaus.groovy.ast.expr.PropertyExpression}
//      * {@link org.codehaus.groovy.ast.expr.ClassExpression}, or a {@link org.codehaus.groovy.ast.expr.ConstantExpression}
//      * @return the current instance of {@link AnnotationNodeBuilder}
//      */
//     public AnnotationNodeBuilder member(final String name, final Expression expression) {
//         this.annotationNode.addMember(name, expression);
// 
//         return this;
//     }
// 
//     /**
//      * Returns the annotation node configured by this builder
//      *
//      * @return an instance of {@link AnnotationNode}
//      */
//     public AnnotationNode build() {
//         return this.annotationNode;
//     }
// 
// }


import static org.codehaus.groovy.runtime.StringGroovyMethods.take;
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.any;
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.find;
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.first;
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.last;
import java.util.Map;
import java.util.List;
import java.util.HashMap;
import groovy.lang.Closure;
import groovy.transform.Generated;
import org.codehaus.groovy.ast.ASTNode;
import org.codehaus.groovy.ast.MethodNode;
import org.codehaus.groovy.ast.AnnotationNode;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.ast.FieldNode;
import org.codehaus.groovy.ast.ModuleNode;
import org.codehaus.groovy.ast.PropertyNode;
import org.codehaus.groovy.ast.ClassHelper;
import org.codehaus.groovy.ast.AnnotatedNode;
import org.codehaus.groovy.ast.tools.GeneralUtils;
import org.codehaus.groovy.ast.stmt.Statement;
import org.codehaus.groovy.ast.stmt.ExpressionStatement;
import org.codehaus.groovy.ast.stmt.BlockStatement;
import org.codehaus.groovy.ast.expr.Expression;
import org.codehaus.groovy.ast.expr.ClassExpression;
import org.codehaus.groovy.ast.expr.ConstantExpression;
import org.codehaus.groovy.ast.expr.PropertyExpression;
import org.codehaus.groovy.control.CompilePhase;
import asteroid.A;
import asteroid.utils.StatementUtils.Group;
import asteroid.nodes.AnnotationNodeBuilder;
package asteroid.utils;




/**
 * General utility methods to deal with {@link ASTNode} instances
 *
 * @since 0.1.4
 * @see asteroid.Utils
 */
public class NodeUtils {

    public static final String ANNOTATION_VALUE = "value";

// Path: asteroid-core/src/main/java/asteroid/A.java
// @SuppressWarnings("PMD.ShortClassName")
// public final class A {
// 
//     /**
//      * Entry point to get node builders.
//      *
//      * @since 0.1.0
//      */
//     public static final Nodes NODES = new Nodes();
// 
//     /**
//      * Entry point to access language modifiers
//      *
//      * @since 0.1.0
//      */
//     public static final Modifiers ACC = new Modifiers();
// 
//     /**
//      * Entry point to create statements.
//      *
//      * @since 0.1.0
//      */
//     public static final Statements STMT = new Statements();
// 
//     /**
//      * Entry point to create expressions
//      *
//      * @since 0.1.0
//      */
//     public static final Expressions EXPR = new Expressions();
// 
//     /**
//      * Entry point to get util functions
//      *
//      * @since 0.1.0
//      */
//     public static final Utils UTIL = new Utils();
// 
//     /**
//      * Entry point to get criterias
//      *
//      * @since 0.2.4
//      */
//     public static final Criterias CRITERIA = new Criterias();
// }
// 
// Path: asteroid-core/src/main/java/asteroid/utils/StatementUtils.java
// @SuppressWarnings("PMD.BeanMembersShouldSerialize")
// public static class Group {
//     public final Label label;
//     public final List<Statement> statements;
// 
//     /**
//      * Default constructor
//      *
//      * @param label the label identifying this group
//      * @param statements the statements that belong to this group
//      */
//     Group(final Label label, final List<Statement> statements) {
//         this.label      = label;
//         this.statements = statements;
//     }
// 
//     /**
//      * Utility method to clone a given {@link Group} changing the statement list
//      *
//      * @param newStatements the new statements of the group
//      * @return a new {@link Group}
//      */
//     public Group copyWithStatements(final List<Statement> newStatements) {
//         return new Group(new Label(label.name, label.expression), newStatements);
//     }
// }
// 
// Path: asteroid-core/src/main/java/asteroid/nodes/AnnotationNodeBuilder.java
// final public class AnnotationNodeBuilder {
// 
//     private final AnnotationNode annotationNode;
// 
//     private AnnotationNodeBuilder(final AnnotationNode annotationNode) {
//         this.annotationNode = annotationNode;
//     }
// 
//     /**
//      * Creates an instance of {@link AnnotationNodeBuilder}
//      * <br><br>
//      *
//      * <strong>AST</strong>
//      * <pre><code>annotation(MyAnnotation.class).build()</code></pre>
//      *
//      * <strong>Result</strong>
//      * <pre><code>@MyAnnotation</code></pre>
//      *
//      * @param clazz the annotation type
//      * @return an instance of {@link AnnotationNodeBuilder}
//      */
//     public static AnnotationNodeBuilder annotation(final Class clazz) {
//         return new AnnotationNodeBuilder(new AnnotationNode(A.NODES.clazz(clazz).build()));
//     }
// 
//     /**
//      * Adds a new member to the annotation
//      * <br><br>
//      *
//      * <strong>AST</strong>
//      * <pre><code>annotation(MyAnnotation.class)
//      * .member('value', classX(String.class))
//      * .build()</code></pre>
//      *
//      * <strong>Result</strong>
//      * <pre><code>@MyAnnotation(String.class)</code></pre>
//      *
//      * @param name the name of the new member
//      * @param expression the  value of the new member. It could be {@link org.codehaus.groovy.ast.expr.PropertyExpression}
//      * {@link org.codehaus.groovy.ast.expr.ClassExpression}, or a {@link org.codehaus.groovy.ast.expr.ConstantExpression}
//      * @return the current instance of {@link AnnotationNodeBuilder}
//      */
//     public AnnotationNodeBuilder member(final String name, final Expression expression) {
//         this.annotationNode.addMember(name, expression);
// 
//         return this;
//     }
// 
//     /**
//      * Returns the annotation node configured by this builder
//      *
//      * @return an instance of {@link AnnotationNode}
//      */
//     public AnnotationNode build() {
//         return this.annotationNode;
//     }
// 
// }


// Path: asteroid-core/src/main/java/asteroid/utils/NodeUtils.java
import static org.codehaus.groovy.runtime.StringGroovyMethods.take;
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.any;
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.find;
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.first;
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.last;
import java.util.Map;
import java.util.List;
import java.util.HashMap;
import groovy.lang.Closure;
import groovy.transform.Generated;
import org.codehaus.groovy.ast.ASTNode;
import org.codehaus.groovy.ast.MethodNode;
import org.codehaus.groovy.ast.AnnotationNode;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.ast.FieldNode;
import org.codehaus.groovy.ast.ModuleNode;
import org.codehaus.groovy.ast.PropertyNode;
import org.codehaus.groovy.ast.ClassHelper;
import org.codehaus.groovy.ast.AnnotatedNode;
import org.codehaus.groovy.ast.tools.GeneralUtils;
import org.codehaus.groovy.ast.stmt.Statement;
import org.codehaus.groovy.ast.stmt.ExpressionStatement;
import org.codehaus.groovy.ast.stmt.BlockStatement;
import org.codehaus.groovy.ast.expr.Expression;
import org.codehaus.groovy.ast.expr.ClassExpression;
import org.codehaus.groovy.ast.expr.ConstantExpression;
import org.codehaus.groovy.ast.expr.PropertyExpression;
import org.codehaus.groovy.control.CompilePhase;
import asteroid.A;
import asteroid.utils.StatementUtils.Group;
import asteroid.nodes.AnnotationNodeBuilder;

package asteroid.utils;




/**
 * General utility methods to deal with {@link ASTNode} instances
 *
 * @since 0.1.4
 * @see asteroid.Utils
 */
public class NodeUtils {

    public static final String ANNOTATION_VALUE = "value";

    private static final AnnotationNode GENERATED = AnnotationNodeBuilder