当前位置: 首页>>代码示例>>Java>>正文


Java ResolvedSourceCode类代码示例

本文整理汇总了Java中codemining.languagetools.bindings.ResolvedSourceCode的典型用法代码示例。如果您正苦于以下问题:Java ResolvedSourceCode类的具体用法?Java ResolvedSourceCode怎么用?Java ResolvedSourceCode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResolvedSourceCode类属于codemining.languagetools.bindings包,在下文中一共展示了ResolvedSourceCode类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitCommitFiles

import codemining.languagetools.bindings.ResolvedSourceCode; //导入依赖的package包/类
@Override
public void visitCommitFiles(final RevCommit commit) {
	System.out.println("Visiting " + commit + " for renamings");
	final Collection<Renaming> renamingsAtThisPoint = renamings
			.get(commit.name());
	for (final Renaming renaming : renamingsAtThisPoint) {
		// Get the file
		final File currentFile = new File(
				repositoryDir.getAbsolutePath() + renaming.filename);
		checkArgument(currentFile.exists());

		try {
			ResolvedSourceCode resolvedCode = variableExtractor
					.getResolvedSourceCode(currentFile,
							n -> matchRenaming(renaming, n));
			if (!resolvedCode.getAllBindings().isEmpty()) {
				renamedVariablesDatapoints
						.add(RenamedSerializableResolvedSourceCode
								.fromResolvedSourceCode(
										resolvedCode,
										Lists.newArrayList(renaming.nameBefore)));
			} else {
				resolvedCode = methodDeclExtractor
						.getResolvedSourceCode(currentFile,
								n -> matchRenaming(renaming, n));
				if (!resolvedCode.getAllBindings().isEmpty()) {
					renamedMethodDeclarationsDatapoints
							.add(RenamedSerializableResolvedSourceCode.fromResolvedSourceCode(
									resolvedCode,
									Lists.newArrayList(renaming.nameBefore)));
				}
			}
		} catch (final IOException e) {
			// File always exists, since we checked above.
			throw new IllegalStateException(e);
		}
	}
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:39,代码来源:RenamingDatasetExtractor.java

示例2: SerializableResolvedSourceCode

import codemining.languagetools.bindings.ResolvedSourceCode; //导入依赖的package包/类
protected SerializableResolvedSourceCode(final ResolvedSourceCode rsc) {
	codeTokens = rsc.codeTokens;
	boundVariables = Lists.newArrayList();
	boundVariableFeatures = Lists.newArrayList();
	for (final TokenNameBinding binding : rsc.getAllBindings()) {
		boundVariables.add(new ArrayList<Integer>(binding.nameIndexes));
		boundVariableFeatures.add(new ArrayList<String>(
				binding.features));
	}
	provenance = rsc.name;
}
 
开发者ID:mast-group,项目名称:tassal,代码行数:12,代码来源:JavaBindingsToJson.java

示例3: getResolvedCode

import codemining.languagetools.bindings.ResolvedSourceCode; //导入依赖的package包/类
public static ResolvedSourceCode getResolvedCode(final File f,
		final AbstractJavaNameBindingsExtractor extractor) {
	try {
		return extractor.getResolvedSourceCode(f);
	} catch (final Throwable t) {
		LOGGER.warning("Error for file " + f + ": "
				+ ExceptionUtils.getFullStackTrace(t));
	}
	return null;
}
 
开发者ID:mast-group,项目名称:tassal,代码行数:11,代码来源:JavaBindingsToJson.java

示例4: getResolvedSourceCode

import codemining.languagetools.bindings.ResolvedSourceCode; //导入依赖的package包/类
@Override
public ResolvedSourceCode getResolvedSourceCode(final File f)
		throws IOException {
	final JavaASTExtractor ex = createExtractor();
	return getResolvedSourceCode(FileUtils.readFileToString(f),
			getNameBindings(ex.getAST(f)), f.getAbsolutePath());
}
 
开发者ID:mast-group,项目名称:tassal,代码行数:8,代码来源:AbstractJavaNameBindingsExtractor.java

示例5: getResolvedSourceCode

import codemining.languagetools.bindings.ResolvedSourceCode; //导入依赖的package包/类
public static ResolvedSourceCode getResolvedSourceCode(
		final String sourceCode, final Set<Set<ASTNode>> nodeBindings) {
	final JavascriptTokenizer tokenizer = new JavascriptTokenizer();
	final SortedMap<Integer, String> tokenPositions = tokenizer
			.tokenListWithPos(sourceCode.toCharArray());
	final SortedMap<Integer, Integer> positionToIndex = getTokenIndexForPostion(tokenPositions);
	final List<String> tokens = Lists.newArrayList(tokenPositions.values());

	final ArrayListMultimap<String, TokenNameBinding> bindings = ArrayListMultimap
			.create();

	for (final Set<ASTNode> boundName : nodeBindings) {
		if (boundName.isEmpty()) {
			continue;
		}
		final List<Integer> boundPositions = Lists.newArrayList();
		for (final ASTNode name : boundName) {
			// Convert position to token index and add
			final int tokenIdx = positionToIndex.get(name
					.getStartPosition());
			boundPositions.add(tokenIdx);
		}
		bindings.put(tokens.get(boundPositions.get(0)),
				new TokenNameBinding(Sets.newTreeSet(boundPositions),
						tokens, getFeatures(boundName)));
	}

	return new ResolvedSourceCode(tokens, bindings);
}
 
开发者ID:mast-group,项目名称:tassal,代码行数:30,代码来源:AbstractJavascriptNameBindingsExtractor.java

示例6: fromResolvedSourceCode

import codemining.languagetools.bindings.ResolvedSourceCode; //导入依赖的package包/类
public static RenamedSerializableResolvedSourceCode fromResolvedSourceCode(
		final ResolvedSourceCode rsc, final List<String> previousNames) {
	return new RenamedSerializableResolvedSourceCode(rsc, previousNames);
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:5,代码来源:RenamingDatasetExtractor.java

示例7: RenamedSerializableResolvedSourceCode

import codemining.languagetools.bindings.ResolvedSourceCode; //导入依赖的package包/类
protected RenamedSerializableResolvedSourceCode(
		final ResolvedSourceCode rsc, final List<String> previousNames) {
	super(rsc);
	this.previousNames = previousNames;
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:6,代码来源:RenamingDatasetExtractor.java

示例8: fromResolvedSourceCode

import codemining.languagetools.bindings.ResolvedSourceCode; //导入依赖的package包/类
public static SerializableResolvedSourceCode fromResolvedSourceCode(
		final ResolvedSourceCode rsc) {
	return new SerializableResolvedSourceCode(rsc);
}
 
开发者ID:mast-group,项目名称:tassal,代码行数:5,代码来源:JavaBindingsToJson.java


注:本文中的codemining.languagetools.bindings.ResolvedSourceCode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。