本文整理汇总了Java中edu.uci.ics.jung.graph.DelegateTree.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java DelegateTree.getChildren方法的具体用法?Java DelegateTree.getChildren怎么用?Java DelegateTree.getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.uci.ics.jung.graph.DelegateTree
的用法示例。
在下文中一共展示了DelegateTree.getChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeClustersFromDB
import edu.uci.ics.jung.graph.DelegateTree; //导入方法依赖的package包/类
private void removeClustersFromDB(
DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>> tree,
ClusterVO vertex) {
List<ItemAssocVO<Integer,Integer>> edges =
itemAssocService.getItemAssocsForItem(vertex.getItem().getTenant(), vertex.getItem(), null);
//remove all edges in db
for (ItemAssocVO<Integer,Integer> edge : edges) {
itemAssocService.removeItemAssoc(edge.getId());
}
profileDAO.deactivateProfile(vertex.getItem().getTenant(), vertex.getItem().getItem(),
vertex.getItem().getType());
// remove all items from cluster
for (ItemVO<Integer, Integer> item : getItemsOfCluster(vertex)) {
try {
removeItemFromCluster(vertex, item);
} catch (ClusterException ce) {
logger.error(ce.getMessage());
}
}
for (ClusterVO child : tree.getChildren(vertex)) {
removeClustersFromDB(tree, child);
}
}
示例2: 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);
}
示例3: 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;
}