本文整理匯總了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;
}
}
}