本文整理汇总了Java中edu.uci.ics.jung.graph.DelegateTree类的典型用法代码示例。如果您正苦于以下问题:Java DelegateTree类的具体用法?Java DelegateTree怎么用?Java DelegateTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DelegateTree类属于edu.uci.ics.jung.graph包,在下文中一共展示了DelegateTree类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createGraph
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
@Override
public Graph<String, String> createGraph() {
Tree<String, String> graph = new DelegateTree<String, String>();
if (clusterModel.getRootNode() == null) {
return graph;
}
HierarchicalClusterNode root = clusterModel.getRootNode();
graph.addVertex("Root");
vertexMap.put("Root", root);
for (HierarchicalClusterNode subNode : clusterModel.getRootNode().getSubNodes()) {
createGraph(graph, "Root", subNode);
}
return graph;
}
开发者ID:transwarpio,项目名称:rapidminer,代码行数:17,代码来源:ClusterModelGraphCreator.java
示例2: generateGraph
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
private Forest generateGraph()
{
/*position vertices in graph*/
// DirectedSparseGraph<Node, HyperEdge> graph =
// new DirectedSparseGraph<Node, HyperEdge>();
DelegateTree graph =
new DelegateTree<HyperEdge, Node>();
EventsNode ev0 = new EventsNode(0, 5);
// TrackNode tr1 = new TrackNode(0, 1, 0, 0, true, true);
TrackNode tr1 = new TrackNode(0, 1, 0, 0);
EventsNode ev1 = new EventsNode(1, 0);
graph.addVertex(ev0);
graph.addChild(new HyperEdge(1.0), ev0, ev1);
graph.addChild(new HyperEdge(1.0), ev0, tr1);
// graph.addEdge(ev0, Arrays.asList(ev1, tr1));
// graph.addEdge(new HyperEdge(1.0), ev0, tr1);
return graph;
}
开发者ID:sinantie,项目名称:Generator,代码行数:21,代码来源:VisualiseHypergraph.java
示例3: afterPropertiesSet
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
@Override
public void afterPropertiesSet() {
// for each tenant
//build tree from itemassoc
List<TenantVO> tenants = tenantService.getAllTenants();
for (TenantVO tenantVO : tenants) {
// logger.info("building Cluster tree for tenant " + tenantVO.getId());
initTenantForClusters(tenantVO);
DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>> tenantClusters =
clusters.get(tenantVO.getId());
buildTree(tenantClusters, tenantClusters.getRoot());
//clusters.put(tenantVO.getId(), tenantClusters);
}
}
开发者ID:major2015,项目名称:easyrec_major,代码行数:17,代码来源:ClusterServiceImpl.java
示例4: buildTree
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
private void buildTree(
DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>> tree,
ClusterVO vertex) {
Integer assocTypeCluster =
assocTypeDAO.getIdOfType(vertex.getItem().getTenant(), ClusterService.ASSOCTYPE_CLUSTER);
List<ItemAssocVO<Integer,Integer>> edges = itemAssocService
.getItemAssocs(vertex.getItem(), assocTypeCluster, null,
new IAConstraintVO<Integer, Integer>(null, vertex.getItem().getTenant()));
for (ItemAssocVO<Integer,Integer> edge : edges) {
ItemVO<Integer, Integer> child = edge.getItemTo();
ClusterVO childVertex = loadCluster(child.getTenant(), child.getItem(), child.getType());
if (childVertex != null) {
tree.addChild(edge, vertex, childVertex);
buildTree(tree, childVertex);
}
}
}
开发者ID:major2015,项目名称:easyrec_major,代码行数:20,代码来源:ClusterServiceImpl.java
示例5: 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);
}
}
开发者ID:major2015,项目名称:easyrec_major,代码行数:24,代码来源:ClusterServiceImpl.java
示例6: CreatePhyloTreeGraph
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
/**
* Class constructor
*
* @param phylogeny describes the tree, which will be created.
*/
public CreatePhyloTreeGraph(Phylogeny phylogeny) {
g3 = new DelegateTree<Cell, Clade>();
List<Clade> cladeList = phylogeny.getAllCladeInPhylogeny();
List<Cell> cellsList = new ArrayList<Cell>();//phylogeny.getForest().getCellsListFromCladesList(cladeList);
Clade rootClade = phylogeny.getRootClade();
g3.setRoot(rootClade.getCellObject());
int leng = cladeList.size();
for(int i=1; i < leng ; i++) {
Clade cld = cladeList.get(i);
Cell cell = cld.getCellObject();
cell.setPhyloTreeGraph(g3);
cellsList.add(cell);
Cell parentCell = cell.getParentCell();
g3.addChild(cld, parentCell, cell);
}
// for(int i=1; i < cellsList.size() ; i++) {
// cellsList.get(i).setPhyloTreeGraph(g3);
// }
// System.out.println("g3-Height: " + g3.getHeight());
// g2.addTree(g3);
}
开发者ID:modsim,项目名称:vizardous,代码行数:29,代码来源:CreatePhyloTreeGraph.java
示例7: getConstraintSolverHierarchy
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
/**
* Get the hierarchy of {@link ConstraintSolver}s rooted in this {@link MultiConstraintSolver}.
* @return The hierarchy of {@link ConstraintSolver}s rooted in this {@link MultiConstraintSolver}.
*/
public DelegateTree<ConstraintSolver,String> getConstraintSolverHierarchy() {
DelegateTree<ConstraintSolver,String> ret = new DelegateTree<ConstraintSolver, String>();
ret.setRoot(this);
ConstraintSolver[] myConstraintSolvers = this.getConstraintSolvers();
for (int i = 0; i < myConstraintSolvers.length; i++) {
String edgeLabel = i + " (" + this.hashCode() + ")";
if (myConstraintSolvers[i] instanceof MultiConstraintSolver) {
DelegateTree<ConstraintSolver,String> subtree = ((MultiConstraintSolver)myConstraintSolvers[i]).getConstraintSolverHierarchy();
TreeUtils.addSubTree(ret, subtree, this, edgeLabel);
}
else {
ret.addChild(edgeLabel, this, myConstraintSolvers[i]);
}
}
return ret;
}
开发者ID:FedericoPecora,项目名称:meta-csp-framework,代码行数:21,代码来源:MultiConstraintSolver.java
示例8: getConstraintNetworkHierarchy
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
/**
* Get a tree whose nodes are the constraint networks managed by the hierarchy of
* {@link ConstraintSolver}s underlying this {@link MultiConstraintSolver}.
* @return A tree whose nodes are the constraint networks managed by the hierarchy of
* {@link ConstraintSolver}s underlying this {@link MultiConstraintSolver}.
*/
public DelegateTree<ConstraintNetwork,String> getConstraintNetworkHierarchy() {
DelegateTree<ConstraintNetwork,String> ret = new DelegateTree<ConstraintNetwork, String>();
ConstraintNetwork myCN = this.getConstraintNetwork();
ret.setRoot(myCN);
ConstraintSolver[] myConstraintSolvers = this.getConstraintSolvers();
for (int i = 0; i < myConstraintSolvers.length; i++) {
String edgeLabel = i + " (" + this.hashCode() + ")";
if (myConstraintSolvers[i] instanceof MultiConstraintSolver) {
DelegateTree<ConstraintNetwork,String> subtree = ((MultiConstraintSolver)myConstraintSolvers[i]).getConstraintNetworkHierarchy();
TreeUtils.addSubTree(ret, subtree, myCN, edgeLabel);
}
else {
ret.addChild(edgeLabel, myCN, myConstraintSolvers[i].getConstraintNetwork());
}
}
return ret;
}
开发者ID:FedericoPecora,项目名称:meta-csp-framework,代码行数:24,代码来源:MultiConstraintSolver.java
示例9: ClusterServiceImpl
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
public ClusterServiceImpl(ProfileDAO profileDAO,
ItemAssocService itemAssocService,
IDMappingDAO idMappingDAO,
TenantService tenantService,
ItemTypeDAO itemTypeDAO,
AssocTypeDAO assocTypeDAO,
SourceTypeDAO sourceTypeDAO,
ViewTypeDAO viewTypeDAO) {
this.profileDAO = profileDAO;
this.itemAssocService = itemAssocService;
this.tenantService = tenantService;
this.idMappingDAO = idMappingDAO;
this.itemTypeDAO = itemTypeDAO;
this.assocTypeDAO = assocTypeDAO;
this.sourceTypeDAO = sourceTypeDAO;
this.viewTypeDAO = viewTypeDAO;
this.clusters =
new HashMap<Integer, DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>>>();
try {
context = JAXBContext.newInstance(org.easyrec.model.core.ClusterVO.class);
} catch (Exception e) {
logger.error("Could not instantiate JAXB Context for ClusterService!", e);
}
}
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:25,代码来源:ClusterServiceImpl.java
示例10: getTrees
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
public Collection<Tree<V, E>> getTrees() {
Collection<Tree<V,E>> trees = new HashSet<Tree<V,E>>();
for(V v : getRoots()) {
Tree<V,E> tree = new DelegateTree<V,E>();
tree.addVertex(v);
TreeUtils.growSubTree(this, tree, v);
trees.add(tree);
}
return trees;
}
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:11,代码来源:DelegateForest.java
示例11: addCluster
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
public void addCluster(ClusterVO cluster, ClusterVO parent) throws ClusterException {
DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>> tree =
clusters.get(parent.getItem().getTenant());
if (tree.containsVertex(cluster)) throw new ClusterException("Cannot add cluster! Cluster already exists!");
if (tree.containsVertex(parent)) {
storeCluster(cluster);
ItemAssocVO<Integer,Integer> edge =
new ItemAssocVO<Integer,Integer>(
parent.getItem().getTenant(), // tenantId
parent.getItem(), //itemFrom
assocTypeDAO.getIdOfType(parent.getItem().getTenant(), ClusterService.ASSOCTYPE_CLUSTER),
//assocType
1.0, //assocValue
cluster.getItem(), //itemTo
sourceTypeDAO.getIdOfType(parent.getItem().getTenant(),
SourceTypeDAO.SOURCETYPE_MANUALLY_CREATED), //sourceType
"", //comment
viewTypeDAO.getIdOfType(parent.getItem().getTenant(), ViewTypeDAO.VIEWTYPE_ADMIN),
true); //timeStamp
itemAssocService.insertOrUpdateItemAssoc(edge);
tree.addChild(edge, parent, cluster);
} else {
throw new ClusterException("Parent cluster could not be found!");
}
//check if profile with name already exists
// if yes reject : cluster already exists
// else check if parent exists, if not reject.
// find parent;
// insert child;
// store itemassoc
}
开发者ID:major2015,项目名称:easyrec_major,代码行数:34,代码来源:ClusterServiceImpl.java
示例12: removeCluster
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
public void removeCluster(Integer tenantId, String name) {
//remove itemassoc (tree); if not leaf, remove whole subtree
DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>> tree =
clusters.get(tenantId);
ClusterVO cluster = loadCluster(tenantId, idMappingDAO.lookup(name),
itemTypeDAO.getIdOfType(tenantId, ClusterService.ITEMTYPE_CLUSTER));
// disconnect subtree
ItemAssocVO<Integer,Integer> parentEdge = tree.getParentEdge(cluster);
itemAssocService.removeItemAssoc(parentEdge.getId());
//now remove rest of subtree including all itemassocs (item->cluster)
removeClustersFromDB(tree, cluster);
tree.removeChild(cluster);
}
开发者ID:major2015,项目名称:easyrec_major,代码行数:15,代码来源:ClusterServiceImpl.java
示例13: moveCluster
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
public void moveCluster(Integer tenantId, String clusterName, String newParent) {
DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>> tree =
clusters.get(tenantId);
ClusterVO cluster = loadCluster(tenantId, idMappingDAO.lookup(clusterName),
itemTypeDAO.getIdOfType(tenantId, ClusterService.ITEMTYPE_CLUSTER));
// disconnect subtree
ItemAssocVO<Integer,Integer> parentEdge = tree.getParentEdge(cluster);
itemAssocService.removeItemAssoc(parentEdge.getId());
tree.removeChild(cluster);
// add cluster as child to new parent
ClusterVO parent = loadCluster(tenantId, idMappingDAO.lookup(newParent),
itemTypeDAO.getIdOfType(tenantId, ClusterService.ITEMTYPE_CLUSTER));
ItemAssocVO<Integer,Integer> edge =
new ItemAssocVO<Integer,Integer>(
parent.getItem().getTenant(), // tenantId
parent.getItem(), //itemFrom
assocTypeDAO.getIdOfType(parent.getItem().getTenant(), ClusterService.ASSOCTYPE_CLUSTER),
//assocType
1.0, //assocValue
cluster.getItem(), //itemTo
sourceTypeDAO.getIdOfType(parent.getItem().getTenant(),
SourceTypeDAO.SOURCETYPE_MANUALLY_CREATED), //sourceType
"", //comment
viewTypeDAO.getIdOfType(parent.getItem().getTenant(), ViewTypeDAO.VIEWTYPE_ADMIN),
true); //timeStamp
itemAssocService.insertOrUpdateItemAssoc(edge);
tree.addChild(edge, parent, cluster);
buildTree(tree, cluster);
}
开发者ID:major2015,项目名称:easyrec_major,代码行数:33,代码来源:ClusterServiceImpl.java
示例14: 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
示例15: 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
示例16: 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
示例17: 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
示例18: testLoadClusters
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
@Test
public void testLoadClusters() {
DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>> clusters = clusterService.getClustersForTenant(1);
ClusterVO root = clusters.getRoot();
printCluster(clusters, root);
assertThat(clusters.getHeight(), is(2));
assertThat(clusters.getChildCount(root), is(2));
assertThat(clusters.getVertexCount(), is(5));
}
开发者ID:major2015,项目名称:easyrec_major,代码行数:11,代码来源:ClusterServiceTest.java
示例19: testGetSiblings
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
@Test
public void testGetSiblings() {
DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>> clusters = clusterService.getClustersForTenant(1);
List<ClusterVO> siblings = clusterService.getSiblings(1, "CLUSTER1");
for (ClusterVO clusterVO : siblings) {
logger.info("Sibling of CLUSTER1: " + clusterVO.getName());
}
printCluster(clusters,clusters.getRoot());
assertThat(siblings.size(), is(1));
assertThat(siblings.get(0).getName(), is("CLUSTER2"));
}
开发者ID:major2015,项目名称:easyrec_major,代码行数:12,代码来源:ClusterServiceTest.java
示例20: loadtreedata
import edu.uci.ics.jung.graph.DelegateTree; //导入依赖的package包/类
public ModelAndView loadtreedata(HttpServletRequest request, HttpServletResponse httpServletResponse) {
ModelAndView mav = new ModelAndView("clustermanager/ajax/loadtreedata");
RemoteTenant remoteTenant = viewInitializationService.initializeView(request, mav);
if (remoteTenant == null) {
logger.warn("no tenantId supplied");
return mav;
}
DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>>
clusterTree = clusterService.getClustersForTenant(remoteTenant.getId());
ObjectMapper om = new ObjectMapper();
StringWriter sw = new StringWriter();
JsonTreeGraphWriterJackson converter = new JsonTreeGraphWriterJackson();
ClusterNode n = converter.convert(clusterTree);
try {
om.writeValue(sw, n);
} catch (IOException ex) {
logger.warn("failed to serialize cluster tree to JSON", ex);
}
String tree = sw.toString();
mav.addObject("treeJsonData", tree);
return mav;
}
开发者ID:major2015,项目名称:easyrec_major,代码行数:29,代码来源:ClusterManagerController.java
注:本文中的edu.uci.ics.jung.graph.DelegateTree类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论