Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 214:a0c9710e0566
List iterator bug fix
author | tatsuki |
---|---|
date | Wed, 05 Aug 2015 00:36:57 +0900 |
parents | 7da9056e9357 |
children | 1b3661be3119 |
files | src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/data/list/List.java src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/DefaultTreeNode.java src/test/java/jp/ac/u_ryukyu/ie/cr/tatsuki/list/listIterator.java |
diffstat | 3 files changed, 5 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/data/list/List.java Tue Aug 04 23:07:43 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/data/list/List.java Wed Aug 05 00:36:57 2015 +0900 @@ -61,7 +61,7 @@ @Override public boolean hasNext() { - return currentNode.getNext().getAttribute() != null; + return currentNode.getAttribute() != null; } @Override @@ -76,7 +76,7 @@ public Iterator<T> reverseIterator() { Node<T> currentNode = head.getNext(); Stack<T> stack = new Stack<>(); - while (currentNode.getNext().getAttribute() != null) { + while (currentNode.getAttribute() != null) { stack.push(currentNode.getAttribute()); currentNode = currentNode.getNext(); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/DefaultTreeNode.java Tue Aug 04 23:07:43 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/DefaultTreeNode.java Wed Aug 05 00:36:57 2015 +0900 @@ -54,11 +54,6 @@ } @Override - public String getNodeId() { - return nodeId; - } - - @Override public int compareTo(TreeNode o) { return this.hashCode() - o.hashCode(); }
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/tatsuki/list/listIterator.java Tue Aug 04 23:07:43 2015 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/tatsuki/list/listIterator.java Wed Aug 05 00:36:57 2015 +0900 @@ -13,18 +13,18 @@ @Test public void listIteratorTest() { List<Integer> list = new List<Integer>(); - for (int count = 1; count <= 100; count++) { + for (int count = 1; count < 10; count++) { list = list.addLast(count); } Iterator<Integer> iterator = list.iterator(); - for (int count = 1; count < 100; count++) { + for (int count = 1; count < 10; count++) { Assert.assertTrue(iterator.hasNext()); int attribute = iterator.next(); Assert.assertEquals(attribute, count); } iterator = list.reverseIterator(); - for (int count = 100; count > 0; count--) { + for (int count = 9; count > 0; count--) { Assert.assertTrue(iterator.hasNext()); int attribute = iterator.next(); Assert.assertEquals(attribute, count);