本文整理汇总了Java中edu.uci.ics.jung.graph.DelegateTree.isRoot方法的典型用法代码示例。如果您正苦于以下问题:Java DelegateTree.isRoot方法的具体用法?Java DelegateTree.isRoot怎么用?Java DelegateTree.isRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.uci.ics.jung.graph.DelegateTree
的用法示例。
在下文中一共展示了DelegateTree.isRoot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renameCluster
import edu.uci.ics.jung.graph.DelegateTree; //导入方法依赖的package包/类
public void renameCluster(Integer tenantId, String clusterName, String newName) throws ClusterException {
ClusterVO cluster = loadCluster(tenantId, idMappingDAO.lookup(clusterName),
itemTypeDAO.getIdOfType(tenantId, ClusterService.ITEMTYPE_CLUSTER));
DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>> tree =
clusters.get(tenantId);
if (tree.isRoot(cluster)) throw new ClusterException("ROOT cluster cannot be renamed!");
ClusterVO parent = tree.getParent(cluster);
ClusterVO newCluster = new ClusterVO(tenantId, idMappingDAO.lookup(newName),
itemTypeDAO.getIdOfType(tenantId, ClusterService.ITEMTYPE_CLUSTER), newName, cluster.getDescription());
// add the new cluster
addCluster(newCluster, parent);
// move all children to the new cluster
for (ClusterVO child : tree.getChildren(cluster)) {
moveCluster(tenantId, child.getName(), newName);
}
if (logger.isDebugEnabled()) {
logger.debug("removed all children: " + tree.isLeaf(cluster));
}
// move all items to the new cluster
for (ItemVO<Integer, Integer> item : getItemsOfCluster(cluster)) {
addItemToCluster(newCluster, item);
}
// delete the old cluster
removeCluster(tenantId, clusterName);
}
示例2: updateClusterDescription
import edu.uci.ics.jung.graph.DelegateTree; //导入方法依赖的package包/类
public void updateClusterDescription(Integer tenantId, String clusterName, String newDescription)
throws ClusterException {
ClusterVO cluster = loadCluster(tenantId, idMappingDAO.lookup(clusterName),
itemTypeDAO.getIdOfType(tenantId, ClusterService.ITEMTYPE_CLUSTER));
DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>> tree =
clusters.get(tenantId);
if (tree.isRoot(cluster)) throw new ClusterException("ROOT cluster description cannot be changed!");
cluster.setDescription(newDescription);
storeCluster(cluster);
}
示例3: getParent
import edu.uci.ics.jung.graph.DelegateTree; //导入方法依赖的package包/类
public ClusterVO getParent(Integer tenantId, ClusterVO cluster) {
DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>> tree =
clusters.get(tenantId);
// root has no parent
if (tree.isRoot(cluster)) return null;
return tree.getParent(cluster);
}
示例4: getSiblings
import edu.uci.ics.jung.graph.DelegateTree; //导入方法依赖的package包/类
public List<ClusterVO> getSiblings(Integer tenantId, ClusterVO cluster) {
DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>> tree =
clusters.get(tenantId);
if (tree.isRoot(cluster)) return null; //root has no siblings
ClusterVO parent = tree.getParent(cluster);
Collection<ClusterVO> sibl = tree.getChildren(parent);
List<ClusterVO> siblings = new ArrayList<ClusterVO>();
for (ClusterVO clusterVO : sibl) {
if (!clusterVO.equals(cluster)) siblings.add(clusterVO);
}
return siblings;
}