use of com.synopsys.integration.detectable.detectable.util.DependencyHistory in project synopsys-detect by blackducksoftware.
the class PubDepsParser method parseLines.
private void parseLines(List<String> lines, Map<String, String> resolvedVersions, MutableDependencyGraph dependencyGraph) {
DependencyHistory dependencyHistory = new DependencyHistory();
for (String line : lines) {
int depthOfLine = calculateDepth(line);
if (depthOfLine == 0) {
// non-graph line
continue;
}
int dependencyDepth = depthOfLine - 1;
dependencyHistory.clearDependenciesDeeperThan(dependencyDepth);
String nameOfDependency = parseNameFromlLine(line);
Dependency dependency = createDependency(nameOfDependency, resolvedVersions);
if (dependencyHistory.isEmpty()) {
dependencyGraph.addChildToRoot(dependency);
} else {
dependencyGraph.addChildWithParent(dependency, dependencyHistory.getLastDependency());
}
dependencyHistory.add(dependency);
}
}
Aggregations