Mercurial > hg > Members > tatsuki > bench > jungle-core
comparison src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/DefaultNodePath.java @ 172:809f813d1083
minner change
author | one |
---|---|
date | Tue, 10 Feb 2015 11:28:39 +0900 |
parents | b998fdc99bc0 |
children |
comparison
equal
deleted
inserted
replaced
171:624a7e6a3f75 | 172:809f813d1083 |
---|---|
85 return new DefaultNodePath(path); | 85 return new DefaultNodePath(path); |
86 } | 86 } |
87 }); | 87 }); |
88 } | 88 } |
89 | 89 |
90 | 90 //PATHの一番後ろを取り除いたPATHを新しく作って返す |
91 // EXAMPLE <0,0,3> → <0,0> | |
91 @Override | 92 @Override |
92 public NodePath tail() { | 93 public NodePath tail() { |
93 List<Integer> tail = path.reverse(); | 94 List<Integer> tail = path.reverse(); |
94 tail = tail.tail().reverse(); | 95 tail = tail.tail().reverse(); |
95 return new DefaultNodePath(tail); | 96 return new DefaultNodePath(tail); |
96 } | 97 } |
97 | 98 |
98 @Override | |
99 public boolean compare(NodePath targetPath) { | |
100 | |
101 if (targetPath.size() < path.length()) | |
102 return false; | |
103 | |
104 for (Integer currentNum : path) { | |
105 Pair<Integer, NodePath> currentTargetPathNumPair = targetPath.pop(); | |
106 targetPath = currentTargetPathNumPair.right(); | |
107 if (currentNum != currentTargetPathNumPair.left()) | |
108 return false; | |
109 } | |
110 return true; | |
111 } | |
112 } | 99 } |