use of mrmathami.cia.cpp.ast.DependencyMap in project Cpp4CIA by thanhminhmr.
the class VersionBuilder method calculateWeights.
@Nonnull
private static double[] calculateWeights(@Nonnull double[] weightMap, @Nonnull RootNode rootNode) {
final double[] weights = new double[rootNode.getNodeCount()];
for (final CppNode node : rootNode) {
double directWeight = 0.0;
for (final CppNode dependencyNode : node.getAllDependencyFrom()) {
final DependencyMap dependencyMap = node.getNodeDependencyFrom(dependencyNode);
for (final DependencyType type : DependencyType.values) {
directWeight += weightMap[type.ordinal()] * dependencyMap.getCount(type);
}
}
weights[node.getId()] = directWeight;
}
return weights;
}
Aggregations