diff src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/LoggingIndexAttributes.java @ 104:f9a0e7069811

delete worning halfway
author one
date Fri, 12 Sep 2014 16:22:22 +0900
parents bed3afd5c2e2
children 78ef456c98a0
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/LoggingIndexAttributes.java	Fri Sep 12 14:37:09 2014 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/store/index/LoggingIndexAttributes.java	Fri Sep 12 16:22:22 2014 +0900
@@ -3,6 +3,7 @@
 import java.nio.ByteBuffer;
 
 import fj.data.List;
+import fj.data.Option;
 import fj.data.TreeMap;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingAttributes;
@@ -70,9 +71,17 @@
 		TreeNode newNode = logNode.getWrap();
 		OperationLog newLog = logNode.getOperationLog();
 		String indexKey = new String(value.array());
-		List<TreeNode> list = index.get(indexKey).some();
-		list = list.cons(newNode);
-		index.set(indexKey, list);
+		Option<List<TreeNode>> opList = index.get(indexKey);
+		if (opList.isNone()) {
+			List<TreeNode> list = List.nil();
+			list.cons(newNode);
+			String str = new String(value.array());
+			index.set(str,list);
+		} else {
+			List<TreeNode> list = opList.some();
+			list = list.cons(newNode);
+			index.set(indexKey, list);
+		}
 		Logging logIndexNode = new LoggingIndexNode(newNode, newLog, index);
 		return DefaultEither.newB(logIndexNode);
 	}