Mercurial > hg > Members > tatsuki > bench > jungle-core
comparison src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingChildren.java @ 103:bed3afd5c2e2
add Index but Not use
author | one |
---|---|
date | Fri, 12 Sep 2014 14:37:09 +0900 |
parents | 14ce7a0dedca |
children | 74723b26ad96 |
comparison
equal
deleted
inserted
replaced
101:c297f0015d9e | 103:bed3afd5c2e2 |
---|---|
8 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DeleteChildAtOperation; | 8 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DeleteChildAtOperation; |
9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; | 9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; |
10 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither; | 10 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither; |
11 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; | 11 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; |
12 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; | 12 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; |
13 import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; | |
13 | 14 |
14 public class LoggingChildren //implements EditableChildren | 15 public class LoggingChildren //implements EditableChildren |
15 { | 16 { |
16 private final TreeNode wrap; | 17 private final TreeNode wrap; |
17 private final OperationLog log; | 18 private final OperationLog log; |
34 { | 35 { |
35 LoggingChildren children = wrap.getChildren(); | 36 LoggingChildren children = wrap.getChildren(); |
36 return children.iterator(); | 37 return children.iterator(); |
37 }*/ | 38 }*/ |
38 | 39 |
39 public Either<Error,LoggingNode> edit(NodeOperation _op) | 40 public Either<Error,Logging> edit(NodeOperation _op) |
40 { | 41 { |
41 Either<Error,TreeNode> either = _op.invoke(wrap); | 42 Either<Error,TreeNode> either = _op.invoke(wrap); |
42 if(either.isA()){ | 43 if(either.isA()){ |
43 return DefaultEither.newA(either.a()); | 44 return DefaultEither.newA(either.a()); |
44 } | 45 } |
45 | 46 |
46 TreeNode newWrap = either.b(); | 47 TreeNode newWrap = either.b(); |
47 OperationLog newLog = log.add(_op); | 48 OperationLog newLog = log.add(_op); |
48 LoggingNode newLoggingNode = new LoggingNode(newWrap,newLog); | 49 Logging newLoggingNode = new LoggingNode(newWrap,newLog); |
49 return DefaultEither.newB(newLoggingNode); | 50 return DefaultEither.newB(newLoggingNode); |
50 } | 51 } |
51 | 52 |
52 public Either<Error,LoggingNode> addNewChildAt(final int _pos) | 53 public Either<Error,Logging> addNewChildAt(final int _pos) |
53 { | 54 { |
54 NodeOperation addNewChildAt = new AppendChildAtOperation(_pos); | 55 NodeOperation addNewChildAt = new AppendChildAtOperation(_pos); |
55 return edit(addNewChildAt); | 56 return edit(addNewChildAt); |
56 } | 57 } |
57 | 58 |
58 public Either<Error,LoggingNode> deleteChildAt(final int _pos) | 59 public Either<Error,Logging> deleteChildAt(final int _pos) |
59 { | 60 { |
60 NodeOperation deleteChildAt = new DeleteChildAtOperation(_pos); | 61 NodeOperation deleteChildAt = new DeleteChildAtOperation(_pos); |
61 return edit(deleteChildAt); | 62 return edit(deleteChildAt); |
62 } | 63 } |
63 | 64 |
64 public Either<Error,LoggingNode> at(int _pos) | 65 public Either<Error,Logging> at(int _pos) |
65 { | 66 { |
66 Children children = wrap.getChildren(); | 67 Children children = wrap.getChildren(); |
67 Either<Error,TreeNode> either = children.at(_pos); | 68 Either<Error,TreeNode> either = children.at(_pos); |
68 if(either.isA()){ | 69 if(either.isA()){ |
69 return DefaultEither.newA(either.a()); | 70 return DefaultEither.newA(either.a()); |
70 } | 71 } |
71 | 72 |
72 TreeNode node = either.b(); | 73 TreeNode node = either.b(); |
73 return DefaultEither.newB(new LoggingNode(node)); | 74 Logging logNode = new LoggingNode(node); |
75 return DefaultEither.newB(logNode); | |
74 } | 76 } |
75 } | 77 } |