本文整理汇总了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);
}
}
}
示例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;
}
示例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;
}
示例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());
}
示例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);
}
示例6: fromResolvedSourceCode
import codemining.languagetools.bindings.ResolvedSourceCode; //导入依赖的package包/类
public static RenamedSerializableResolvedSourceCode fromResolvedSourceCode(
final ResolvedSourceCode rsc, final List<String> previousNames) {
return new RenamedSerializableResolvedSourceCode(rsc, previousNames);
}
示例7: RenamedSerializableResolvedSourceCode
import codemining.languagetools.bindings.ResolvedSourceCode; //导入依赖的package包/类
protected RenamedSerializableResolvedSourceCode(
final ResolvedSourceCode rsc, final List<String> previousNames) {
super(rsc);
this.previousNames = previousNames;
}
示例8: fromResolvedSourceCode
import codemining.languagetools.bindings.ResolvedSourceCode; //导入依赖的package包/类
public static SerializableResolvedSourceCode fromResolvedSourceCode(
final ResolvedSourceCode rsc) {
return new SerializableResolvedSourceCode(rsc);
}