comparison src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/treeeditor/RedBlack/RedBlackTreeEditorAttributeTest.java @ 310:474728dcfdb8

add PathType
author tatsuki
date Thu, 26 Jan 2017 23:44:14 +0900
parents f8e75ef7ac5d
children 2a0cb1f0ba4e
comparison
equal deleted inserted replaced
309:f8e75ef7ac5d 310:474728dcfdb8
36 either = editor.success(); 36 either = editor.success();
37 Assert.assertFalse(either.isA()); 37 Assert.assertFalse(either.isA());
38 } 38 }
39 39
40 JungleTreeEditor editor = tree.getJungleTreeEditor(); 40 JungleTreeEditor editor = tree.getJungleTreeEditor();
41 path = path.add(1);
42 NodePath rbtPath = new RedBlackTreeNodePath(balanceKey,ByteBuffer.wrap(("value6".getBytes()))); 41 NodePath rbtPath = new RedBlackTreeNodePath(balanceKey,ByteBuffer.wrap(("value6".getBytes())));
43 Either<Error, JungleTreeEditor> either = editor.putAttribute(rbtPath, key, testPutValue); 42 Either<Error, JungleTreeEditor> either = editor.putAttribute(rbtPath, key, testPutValue);
44 Assert.assertFalse(either.isA()); //AttributeのPutが成功したかどうか調べる 43 Assert.assertFalse(either.isA()); //AttributeのPutが成功したかどうか調べる
45 editor = either.b(); 44 editor = either.b();
46 either = editor.success(); 45 either = editor.success();
49 JungleTree oldTree = tree.getOldTree(tree.revision() - 1).b(); 48 JungleTree oldTree = tree.getOldTree(tree.revision() - 1).b();
50 TreeNode oldRoot = oldTree.getRootNode(); 49 TreeNode oldRoot = oldTree.getRootNode();
51 TreeNode attributePutedTreeRoot = tree.getRootNode(); 50 TreeNode attributePutedTreeRoot = tree.getRootNode();
52 Assert.assertNotEquals(attributePutedTreeRoot,oldRoot);//// とりあえずルートがちゃんと入れ替えられているかを調べる 51 Assert.assertNotEquals(attributePutedTreeRoot,oldRoot);//// とりあえずルートがちゃんと入れ替えられているかを調べる
53 52
54 53
55 TreeNode editedNode = tree.getNodeOfPath(path).b();
56 InterfaceTraverser traverser = tree.getTraverser(true); 54 InterfaceTraverser traverser = tree.getTraverser(true);
57 Iterator<TreeNode> nodeIterator = traverser.find((TreeNode n) -> { 55 Iterator<TreeNode> nodeIterator = traverser.find((TreeNode n) -> {
58 Attributes attributes = n.getAttributes(); 56 Attributes attributes = n.getAttributes();
59 ByteBuffer v = attributes.get(key); 57 ByteBuffer v = attributes.get(key);
60 return v != null && v.equals(testPutValue); 58 return v != null && v.equals(testPutValue);