Java Code Examples for codemining.java.codeutils.JavaASTExtractor#getBestEffortAstNode()

The following examples show how to use codemining.java.codeutils.JavaASTExtractor#getBestEffortAstNode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MethodRetriever.java    From api-mining with GNU General Public License v3.0 5 votes vote down vote up
public static Map<String, MethodDeclaration> getMethodNodes(
		final String file) throws Exception {
	final JavaASTExtractor astExtractor = new JavaASTExtractor(false);
	final MethodRetriever m = new MethodRetriever();
	final ASTNode cu = astExtractor.getBestEffortAstNode(file);
	cu.accept(m);
	return m.methods;
}
 
Example 2
Source File: JavaTypeTokenizer.java    From api-mining with GNU General Public License v3.0 5 votes vote down vote up
@Override
public SortedMap<Integer, FullToken> fullTokenListWithPos(final char[] code) {
	final SortedMap<Integer, FullToken> tokens = baseTokenizer
			.fullTokenListWithPos(code);

	final JavaASTExtractor ex = new JavaASTExtractor(false);
	ASTNode cu;
	try {
		cu = ex.getBestEffortAstNode(code);
		return doApproximateTypeInference(tokens, cu);
	} catch (final Exception e) {
		throw new IllegalArgumentException(e);
	}
}
 
Example 3
Source File: JavaTypeTokenizer.java    From api-mining with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<FullToken> getTokenListFromCode(final char[] code) {
	final SortedMap<Integer, FullToken> tokens = baseTokenizer
			.fullTokenListWithPos(code);

	final JavaASTExtractor ex = new JavaASTExtractor(false);
	ASTNode cu;
	try {
		cu = ex.getBestEffortAstNode(code);
		return getTypedTokens(tokens, cu);
	} catch (final Exception e) {
		throw new IllegalArgumentException(e);
	}

}
 
Example 4
Source File: MethodRetriever.java    From tassal with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static Map<String, MethodDeclaration> getMethodNodes(
		final String file) throws Exception {
	final JavaASTExtractor astExtractor = new JavaASTExtractor(false);
	final MethodRetriever m = new MethodRetriever();
	final ASTNode cu = astExtractor.getBestEffortAstNode(file);
	cu.accept(m);
	return m.methods;
}
 
Example 5
Source File: JavaTypeTokenizer.java    From tassal with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public SortedMap<Integer, FullToken> fullTokenListWithPos(final char[] code) {
	final SortedMap<Integer, FullToken> tokens = baseTokenizer
			.fullTokenListWithPos(code);

	final JavaASTExtractor ex = new JavaASTExtractor(false);
	ASTNode cu;
	try {
		cu = ex.getBestEffortAstNode(code);
		return doApproximateTypeInference(tokens, cu);
	} catch (final Exception e) {
		throw new IllegalArgumentException(e);
	}
}
 
Example 6
Source File: JavaTypeTokenizer.java    From tassal with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public List<FullToken> getTokenListFromCode(final char[] code) {
	final SortedMap<Integer, FullToken> tokens = baseTokenizer
			.fullTokenListWithPos(code);

	final JavaASTExtractor ex = new JavaASTExtractor(false);
	ASTNode cu;
	try {
		cu = ex.getBestEffortAstNode(code);
		return getTypedTokens(tokens, cu);
	} catch (final Exception e) {
		throw new IllegalArgumentException(e);
	}

}
 
Example 7
Source File: MethodRetriever.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static Map<String, MethodDeclaration> getMethodNodes(
		final String file) throws Exception {
	final JavaASTExtractor astExtractor = new JavaASTExtractor(false);
	final MethodRetriever m = new MethodRetriever();
	final ASTNode cu = astExtractor.getBestEffortAstNode(file);
	cu.accept(m);
	return m.methods;
}
 
Example 8
Source File: JavaTypeTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public SortedMap<Integer, FullToken> fullTokenListWithPos(final char[] code) {
	final SortedMap<Integer, FullToken> tokens = baseTokenizer
			.fullTokenListWithPos(code);

	final JavaASTExtractor ex = new JavaASTExtractor(false);
	ASTNode cu;
	try {
		cu = ex.getBestEffortAstNode(code);
		return doApproximateTypeInference(tokens, cu);
	} catch (final Exception e) {
		throw new IllegalArgumentException(e);
	}
}
 
Example 9
Source File: JavaTypeTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public List<FullToken> getTokenListFromCode(final char[] code) {
	final SortedMap<Integer, FullToken> tokens = baseTokenizer
			.fullTokenListWithPos(code);

	final JavaASTExtractor ex = new JavaASTExtractor(false);
	ASTNode cu;
	try {
		cu = ex.getBestEffortAstNode(code);
		return getTypedTokens(tokens, cu);
	} catch (final Exception e) {
		throw new IllegalArgumentException(e);
	}

}