changeset 208:be08961d4c84

fix bug traverse
author tatsuki
date Tue, 19 May 2015 15:15:34 +0900
parents 71624cf77dbf
children e5275a599048
files src/main/java/jp/ac/u_ryukyu/ie/cr/list/DefaultNode.java src/main/java/jp/ac/u_ryukyu/ie/cr/list/headNode.java src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/DefaultTraverser.java
diffstat 3 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/list/DefaultNode.java	Tue May 19 14:41:06 2015 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/list/DefaultNode.java	Tue May 19 15:15:34 2015 +0900
@@ -54,9 +54,8 @@
 
     @Override
     public Node<T> replaceNode(int num, T attribute) {
-        if (this.num - 1 == num) {
-            Node<T> newNode = new DefaultNode(attribute, num, this.next.getNext());
-            return new DefaultNode(this.attribute, num + 1, newNode);
+        if (this.num  == num) {
+            return new DefaultNode(attribute, num, this.getNext());
         }
 
         Node<T> newNode = next.replaceNode(num, attribute);
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/list/headNode.java	Tue May 19 14:41:06 2015 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/list/headNode.java	Tue May 19 15:15:34 2015 +0900
@@ -64,7 +64,7 @@
             return new headNode(newNode);
         }
 
-        Node<T> newNode = next.replaceNode(num, attribute);
+        Node<T> newNode = nextNode.replaceNode(num, attribute);
         if (newNode == null)
             return this;
         return new headNode(newNode);
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/DefaultTraverser.java	Tue May 19 14:41:06 2015 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverser/DefaultTraverser.java	Tue May 19 15:15:34 2015 +0900
@@ -85,7 +85,7 @@
 			}
 			
 			if(r == Result.CONTINUE){
-				pos ++;
+				pos --;
 				continue;
 			}
 			
@@ -119,7 +119,7 @@
 	private <T extends TreeNode> Either<Error,List<Direction<TreeNode>>> _accept(final T _current,final int _pos,Evaluator _evaluator)
 	{
 		Children chs = _current.getChildren();
-		Either<Error,List<Direction<TreeNode>>> either = _traverse(chs,_evaluator,0);
+		Either<Error,List<Direction<TreeNode>>> either = _traverse(chs,_evaluator,chs.size() - 1);
 		if(either.isA()){
 			return either;
 		}