当前位置: 首页>>代码示例>>Java>>正文


Java DelegateTree.isRoot方法代码示例

本文整理汇总了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);

}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:29,代码来源:ClusterServiceImpl.java

示例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);

}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:14,代码来源:ClusterServiceImpl.java

示例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);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:8,代码来源:ClusterServiceImpl.java

示例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;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:13,代码来源:ClusterServiceImpl.java


注:本文中的edu.uci.ics.jung.graph.DelegateTree.isRoot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。