 (defn getImports [root]
   (filter #(instance? com.github.javaparser.ast.ImportDeclaration %)
           (getChildrenNodes root)))
+
+; ============================================
+; Misc
+; ============================================
+
+(defn getNameExprFor [root name]
+  {:pre [root name]}
+  (first (filter (fn [ne] (= name (.getName ne))) (getNameExprs root))))
+
+(defn getMethodDeclaration [root name]
+  {:pre  [root]}
+  (first (filter (fn [ne] (= name (.getName ne))) (getMethodDeclarations root))))

(defn nNotPrivateConstructors [cl]
  (.size (getNotPrivateConstructors cl)))

(defn getParameters [m]
  (let [ps (.getParameters m)]
    (if (nil? ps)
      (java.util.ArrayList.)
      ps)))

(defn getChildrenNodes [root]
  (tree-seq
   #(not-empty (.getChildrenNodes %))
   #(.getChildrenNodes %)
   root))

(defn getMethodCallExprs [root]
  (filter #(instance? MethodCallExpr %)

  (filter #(instance? BlockStmt %)
          (getChildrenNodes root)))

(defn getVariableDeclarationExprs [root]
  (filter #(instance? VariableDeclarationExpr %)
          (getChildrenNodes root)))
