Java Code Examples for codemining.languagetools.ParseType#values()

The following examples show how to use codemining.languagetools.ParseType#values() . 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: JavaASTExtractor.java    From api-mining with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Get the AST by making the best effort to guess the type of the node.
 *
 * @throws Exception
 */
public final ASTNode getBestEffortAstNode(final char[] content)
		throws Exception {
	for (final ParseType parseType : ParseType.values()) {
		final ASTNode node = getASTNode(content, parseType);
		if (normalizeCode(node.toString().toCharArray()).equals(
				normalizeCode(content))) {
			return node;
		}
	}
	throw new Exception(
			"Code snippet could not be recognized as any of the known types");
}
 
Example 2
Source File: JavaASTExtractor.java    From tassal with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Get the AST by making the best effort to guess the type of the node.
 *
 * @throws Exception
 */
public final ASTNode getBestEffortAstNode(final char[] content)
		throws Exception {
	for (final ParseType parseType : ParseType.values()) {
		final ASTNode node = getASTNode(content, parseType);
		if (normalizeCode(node.toString().toCharArray()).equals(
				normalizeCode(content))) {
			return node;
		}
	}
	throw new Exception(
			"Code snippet could not be recognized as any of the known types");
}
 
Example 3
Source File: JavaASTExtractor.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Get the AST by making the best effort to guess the type of the node.
 *
 * @throws Exception
 */
public final ASTNode getBestEffortAstNode(final char[] content)
		throws Exception {
	for (final ParseType parseType : ParseType.values()) {
		final ASTNode node = getASTNode(content, parseType);
		if (normalizeCode(node.toString().toCharArray()).equals(
				normalizeCode(content))) {
			return node;
		}
	}
	throw new Exception(
			"Code snippet could not be recognized as any of the known types");
}