annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 package jungle.impl;
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 import java.util.UUID;
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 import jungle.core.Jungle;
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 import jungle.core.TreeGroup;
6
1a5eaf5ce085 modified AbstractVertexesTest and SimpleVertexes to pass the unit test.
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
6 import jungle.core.graph.Graph;
7
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
7 import jungle.core.graph.Vertex;
1
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 public class SimpleJungle implements Jungle
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 {
6
1a5eaf5ce085 modified AbstractVertexesTest and SimpleVertexes to pass the unit test.
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
11 private final Graph graph;
1
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
6
1a5eaf5ce085 modified AbstractVertexesTest and SimpleVertexes to pass the unit test.
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
13 public SimpleJungle(Graph _graph)
1
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 {
6
1a5eaf5ce085 modified AbstractVertexesTest and SimpleVertexes to pass the unit test.
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
15 graph = _graph;
1
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 }
7
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
17
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
18 @Override
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
19 public TreeGroup createTreeGroup(String _id)
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
20 {
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
21 Vertex vertex = graph.createVertex(_id);
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
22
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
23 if(vertex == null){
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
24 return null;
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
25 }
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
26
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
27 return new SimpleTreeGroup(_id,vertex,graph);
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
28 }
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
29
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
30 @Override
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
31 public TreeGroup getTreeGroupByID(String _id)
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
32 {
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
33 Vertex vertex = graph.getVertex(_id);
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
34 if(vertex != null){
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
35 return new SimpleTreeGroup(_id,vertex,graph);
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
36 }
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
37
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
38 return null;
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
39 }
1
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40
7
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
41 @Override
1
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 public TreeGroup createTreeGroup()
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 {
7
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
44 String groupID = null;
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
45 Vertex vertex = null;
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
46 do{
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
47 groupID = UUID.randomUUID().toString();
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
48 vertex = graph.createVertex(groupID);
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
49 }while(vertex == null);
4
761d04aecfcb added Graph API and some implementation
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
50
7
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
51 return new SimpleTreeGroup(groupID,vertex,graph);
1
b1fa4c494416 added tests , etc..
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 }
7
c3c65308a11b removed some package and added Graph API
shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
53 }