Mercurial > hg > Database > Christie
changeset 219:6cbf93a11d24
add PrefixTreeNode,Config
author | ichikitakahiro <e165713@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 15 Mar 2019 19:16:06 +0900 |
parents | 30f3525e8b15 |
children | 4e89fc999de9 |
files | src/test/java/christie/example/PrefixTree/PrefixTreeNodeConfig.java src/test/java/christie/example/PrefixTree/StartPrefixTree.java src/test/java/christie/example/PrefixTree/prefixNode.java |
diffstat | 3 files changed, 59 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/christie/example/PrefixTree/PrefixTreeNodeConfig.java Fri Mar 15 19:16:06 2019 +0900 @@ -0,0 +1,31 @@ +package christie.example.PrefixTree; + +import christie.topology.node.TopologyNodeConfig; + +public class PrefixTreeNodeConfig extends TopologyNodeConfig { + + int totalNodeNum; + + int i; + + public PrefixTreeNodeConfig(String[] args) { + super(args); + for (int j = 0; j< args.length; j++) { + if ("--totalNodeNum".equals(args[j])) { + totalNodeNum = Integer.parseInt(args[++j]); + + }else if ("--i".equals(args[j])) { + i = Integer.parseInt(args[++j]); + + } + } + } + + public int getTotalNodeNum() { + return totalNodeNum; + } + + public int getI() { + return i; + } +}
--- a/src/test/java/christie/example/PrefixTree/StartPrefixTree.java Fri Mar 15 18:01:06 2019 +0900 +++ b/src/test/java/christie/example/PrefixTree/StartPrefixTree.java Fri Mar 15 19:16:06 2019 +0900 @@ -27,11 +27,18 @@ String[] nodeArg = { "--managerPort", String.valueOf(topologyManagerPort), //使うトポロジーマネージャーを選ぶ "--managerHost", "localhost", - "--localPort", String.valueOf(topologyNodePort + i)}; - TopologyNodeConfig nodeConfig = new TopologyNodeConfig(nodeArg); + "--localPort", String.valueOf(topologyNodePort + i), + "--totalNodeNum", String.valueOf(nodeNum), + "--i", String.valueOf(i)}; + + PrefixNode.main(nodeArg); + + + + /*TopologyNodeConfig nodeConfig = new TopologyNodeConfig(nodeArg); StartTopologyNode startTopologyNode = new StartTopologyNode(nodeConfig, new CheckMyName()); startTopologyNode.put("num", i); - startTopologyNode.put("totalNodeNum", nodeNum - 1);//rootを除いた分のノード数 + startTopologyNode.put("totalNodeNum", nodeNum - 1)*/;//rootを除いた分のノード数 }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/christie/example/PrefixTree/prefixNode.java Fri Mar 15 19:16:06 2019 +0900 @@ -0,0 +1,18 @@ +package christie.example.PrefixTree; + +import christie.codegear.CodeGearManager; +import christie.topology.node.StartTopologyNode; +import christie.topology.node.TopologyNodeConfig; + +public class PrefixNode { + + public static void main(String[] args){ + PrefixTreeNodeConfig prefixTreeNodeConfig = new PrefixTreeNodeConfig(args); + int totalNodeNum = prefixTreeNodeConfig.getTotalNodeNum(); + + StartTopologyNode startTopologyNode = new StartTopologyNode((TopologyNodeConfig) prefixTreeNodeConfig, new CheckMyName()); + + startTopologyNode.put("num", prefixTreeNodeConfig.getI()); + startTopologyNode.put("totalNodeNum", totalNodeNum - 1); + } +}