本文整理汇总了Java中org.apache.maven.shared.dependency.tree.DependencyNode.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java DependencyNode.getParent方法的具体用法?Java DependencyNode.getParent怎么用?Java DependencyNode.getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.shared.dependency.tree.DependencyNode
的用法示例。
在下文中一共展示了DependencyNode.getParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: markParent
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
/**
* Recursively sets the {@link Result}s of all parents of the given node as
* having {@link Result#badDep()}.
*
* @param badDependency A failed {@link DependencyNode}.
*/
private void markParent(final DependencyNode badDependency) {
final DependencyNode parent = badDependency.getParent();
if (parent != null && !isRoot(parent)) {
final Result r = results.get(parent);
// badDep returns the value previously set for the Result#dep field.
// We only set badDep here, thus if it was already true we know we've
// already ascended this path before and do not need to recurse further.
if (!r.badDep()) markParent(parent);
}
}
示例2: isRoot
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
@Override
public boolean isRoot(final DependencyNode node) {
return node.getParent() == null;
}
示例3: initialize
import org.apache.maven.shared.dependency.tree.DependencyNode; //导入方法依赖的package包/类
private void initialize () {
targets2Versions = new HashMap<Artifact, Set<ArtifactVersion>>();
targets2ConfPar = new HashMap<Artifact, Set<DependencyNode>>();
DependencyNode curDn = null;
DependencyNode parent = null;
List<DependencyNode> allDNs = new ArrayList<DependencyNode>(
conflictNode.getDuplicatesOrConflicts());
// prevent conflictNode itself to be included in exclusion targets
if (conflictNode.getPrimaryLevel() > 1) {
allDNs.add(conflictNode.getArtifact());
}
for (DependencyNode dn : allDNs) {
curDn = dn;
parent = curDn.getParent();
// bad luck with no parent...
if (parent == null) {
continue;
}
while (parent.getParent() != null) {
parent = parent.getParent();
curDn = curDn.getParent();
}
Set<DependencyNode> confPar = targets2ConfPar.get(curDn.getArtifact());
if (confPar == null) {
confPar = new HashSet<DependencyNode>();
targets2ConfPar.put(curDn.getArtifact(), confPar);
}
confPar.add(dn.getParent());
Set<ArtifactVersion> versions = targets2Versions.get(curDn.getArtifact());
if (versions == null) {
versions = new HashSet<ArtifactVersion>();
targets2Versions.put(curDn.getArtifact(), versions);
}
versions.add(new DefaultArtifactVersion(dn.getArtifact().getVersion()));
}
}