本文整理汇总了Java中org.codehaus.plexus.util.dag.Vertex类的典型用法代码示例。如果您正苦于以下问题:Java Vertex类的具体用法?Java Vertex怎么用?Java Vertex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vertex类属于org.codehaus.plexus.util.dag包,在下文中一共展示了Vertex类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addDependsOn
import org.codehaus.plexus.util.dag.Vertex; //导入依赖的package包/类
/**
* Add dependency information to the srvModel
*
* @param srvModel
* @throws CycleDetectedException
* @throws ContextException
*/
private void addDependsOn(SrvModel srvModel, List<String> sortedEntries) throws ContextException {
for (String entryName : sortedEntries) {
// Only those that are args in the srvModel
if (!srvModel.getData().keySet().contains(entryName)) continue;
Vertex vertex = dag.getVertex(entryName);
if (vertex.getParentLabels() != null && vertex.getParentLabels().size() > 0) {
List<String> paths = new ArrayList<String>();
for (String dependent : vertex.getParentLabels()) {
if (entryToResultMap.containsKey(dependent)) {
Vertex depVertex = dag.getVertex(dependent);
if (depVertex.getParentLabels()!=null) {
for (String depInternal : depVertex.getParentLabels()) {
if (entryToResultMap.containsKey(depInternal)) {
paths.add(entryToResultMap.get(depInternal));
}
}
}
}
}
if (paths.size()>0) {
dependsOn((Dependency)srvModel, dep(entryName, paths(paths.toArray())));
String topNode = entryName;
if (entryToResultMap.containsKey(entryName))
topNode = entryToResultMap.get(entryName);
if (!topNodes.contains(topNode))
topNodes.add(entryName);
}
}
}
}
示例2: addEdge
import org.codehaus.plexus.util.dag.Vertex; //导入依赖的package包/类
private void addEdge( Vertex fromVertex, Vertex toVertex, MavenProject fromProject,
Map<String, MavenProject> projectMap, boolean force, boolean safe )
throws CycleDetectedException
{
if ( fromVertex.equals( toVertex ) )
{
return;
}
if ( fromProject != null )
{
MavenProject toProject = projectMap.get( toVertex.getLabel() );
fromProject.addProjectReference( toProject );
}
if ( force && toVertex.getChildren().contains( fromVertex ) )
{
dag.removeEdge( toVertex, fromVertex );
}
try
{
dag.addEdge( fromVertex, toVertex );
}
catch ( CycleDetectedException e )
{
if ( !safe )
{
throw e;
}
}
}