Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 300:b060ece7f8e4
implement redBlackTree
keys iterator and have Keys contain
author | tatsuki |
---|---|
date | Thu, 05 Jan 2017 22:13:54 +0900 |
parents | 67ff36237722 |
children | d23faf84eec6 |
files | src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/node/redBlackTree/RedBlackTreeNodeAttribute.java |
diffstat | 1 files changed, 23 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/node/redBlackTree/RedBlackTreeNodeAttribute.java Thu Jan 05 21:56:24 2017 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/node/redBlackTree/RedBlackTreeNodeAttribute.java Thu Jan 05 22:13:54 2017 +0900 @@ -79,18 +79,37 @@ } @Override - public Iterator<String> getKeys() { - return null; + public Iterator<String> getKeys() { + return attrs.keys(); } @Override public boolean contain(String key) { - return false; + if (key.equals(balanceKey)) + return true; + return attrs.contain(key); } @Override public Iterator<String> getFilteringKey(List<String> filter) { - return null; + return new Iterator<String>(){ + String next = balanceKey; + Iterator<String> keys = attrs.keys(); + @Override + public boolean hasNext() { + return next != null; + } + + @Override + public String next() { + String key = next; + if (keys.hasNext()) + next = keys.next(); + else + next = null; + return key; + } + }; } }