# HG changeset patch # User tatsuki # Date 1482232196 -32400 # Node ID 8a746ab2dd02375f66ae59c199a1a5258c38bd37 # Parent 9f38fcb07d36ec990e1bf38d3b2c9907d9d3cb22 Guarantee Difference Transaction append subTree diff -r 9f38fcb07d36 -r 8a746ab2dd02 src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/manager/DifferenceTransactionManager.java --- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/manager/DifferenceTransactionManager.java Tue Dec 20 18:17:18 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/transaction/manager/DifferenceTransactionManager.java Tue Dec 20 20:09:56 2016 +0900 @@ -19,6 +19,7 @@ import java.util.Iterator; import java.util.concurrent.atomic.AtomicReference; +import static jp.ac.u_ryukyu.ie.cr.jungle.util.Error.TransactionError.APPEND_FAILD; import static jp.ac.u_ryukyu.ie.cr.jungle.util.Error.TreeEditorError.APPENDED_NODE_NULL; import static jp.ac.u_ryukyu.ie.cr.jungle.util.Error.TreeEditorError.CAS_MISS; @@ -86,6 +87,8 @@ private Either appendSubTree(TreeNode subTreeRoot) { TreeNode appendedNode = tip.getAppendedNode(); TreeNodeChildren children = appendedNode.getChildren(); + if (children.size() != 0) + return DefaultEither.newA(APPEND_FAILD); //append Nodeが1つ以上子を持つ場合過去の木であるため、変更させない。そうすることで整合性を保証する return children.addNewChildAt(0, subTreeRoot); } diff -r 9f38fcb07d36 -r 8a746ab2dd02 src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/util/Error/TransactionError.java --- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/util/Error/TransactionError.java Tue Dec 20 18:17:18 2016 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/util/Error/TransactionError.java Tue Dec 20 20:09:56 2016 +0900 @@ -5,4 +5,5 @@ */ public class TransactionError { public static final Error INVALID_ARGUMENT = new DefaultError(); + public static final Error APPEND_FAILD = new DefaultError(); }