@@ -0,0 +1,1497 @@
+/**%0A * %0A */%0Apackage codemining.js.codeutils;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.util.Map;%0A%0Aimport org.eclipse.wst.jsdt.core.dom.ASTNode;%0Aimport org.eclipse.wst.jsdt.core.dom.ASTVisitor;%0Aimport org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;%0Aimport org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;%0A%0Aimport com.google.common.collect.Maps;%0A%0A/**%0A * A utility class that retrieves the methods (as AST Nodes) of a file.%0A * %0A * @author Miltos Allamanis%0A * %0A */%0Apublic final class MethodRetriever extends ASTVisitor %7B%0A%0A%09public static Map%3CString, FunctionDeclaration%3E getMethodNodes(%0A%09%09%09final File file) throws IOException %7B%0A%09%09final JavascriptASTExtractor astExtractor = new JavascriptASTExtractor(%0A%09%09%09%09false);%0A%09%09final MethodRetriever m = new MethodRetriever();%0A%09%09final JavaScriptUnit cu = astExtractor.getAST(file);%0A%09%09cu.accept(m);%0A%09%09return m.functions;%0A%09%7D%0A%0A%09public static Map%3CString, FunctionDeclaration%3E getMethodNodes(%0A%09%09%09final String file) throws Exception %7B%0A%09%09final JavascriptASTExtractor astExtractor = new JavascriptASTExtractor(%0A%09%09%09%09false);%0A%09%09final MethodRetriever m = new MethodRetriever();%0A%09%09final ASTNode cu = astExtractor.getCompilationUnitAstNode(file);%0A%09%09cu.accept(m);%0A%09%09return m.functions;%0A%09%7D%0A%0A%09private final Map%3CString, FunctionDeclaration%3E functions = Maps%0A%09%09%09.newTreeMap();%0A%0A%09private MethodRetriever() %7B%0A%0A%09%7D%0A%0A%09@Override%0A%09public boolean visit(final FunctionDeclaration node) %7B%0A%09%09functions.put(node.getName().toString(), node);%0A%09%09return super.visit(node);%0A%09%7D%0A%0A%7D%0A

Add javascript method retriever