Mercurial > hg > Members > tatsuki > bench > jungle-core
view src/main/java/jungle/impl/SimpleJungle.java @ 7:c3c65308a11b
removed some package and added Graph API
author | shoshi <shoshi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 29 Jun 2012 00:03:12 +0900 |
parents | 1a5eaf5ce085 |
children |
line wrap: on
line source
package jungle.impl; import java.util.UUID; import jungle.core.Jungle; import jungle.core.TreeGroup; import jungle.core.graph.Graph; import jungle.core.graph.Vertex; public class SimpleJungle implements Jungle { private final Graph graph; public SimpleJungle(Graph _graph) { graph = _graph; } @Override public TreeGroup createTreeGroup(String _id) { Vertex vertex = graph.createVertex(_id); if(vertex == null){ return null; } return new SimpleTreeGroup(_id,vertex,graph); } @Override public TreeGroup getTreeGroupByID(String _id) { Vertex vertex = graph.getVertex(_id); if(vertex != null){ return new SimpleTreeGroup(_id,vertex,graph); } return null; } @Override public TreeGroup createTreeGroup() { String groupID = null; Vertex vertex = null; do{ groupID = UUID.randomUUID().toString(); vertex = graph.createVertex(groupID); }while(vertex == null); return new SimpleTreeGroup(groupID,vertex,graph); } }