14
|
1 package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer;
|
|
2
|
103
|
3 import fj.data.List;
|
|
4 import fj.data.TreeMap;
|
78
|
5 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode;
|
79
|
6 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.DefaultOperationLog;
|
96
|
7 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingNode;
|
79
|
8 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.OperationLog;
|
|
9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.AppendChildAtOperation;
|
|
10 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation;
|
23
|
11 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither;
|
|
12 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either;
|
24
|
13 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error;
|
103
|
14 import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging;
|
23
|
15
|
29
|
16 public class AppendChildAt implements NodeEditor
|
14
|
17 {
|
|
18 private final int pos;
|
|
19
|
|
20 public AppendChildAt(int _pos)
|
|
21 {
|
|
22 pos = _pos;
|
|
23 }
|
|
24
|
103
|
25 public Either<Error, Logging> _edit(Logging _e)
|
14
|
26 {
|
103
|
27 Either<Error,Logging> either = _e.getChildren().addNewChildAt(pos);
|
23
|
28 if(either.isA()){
|
|
29 // error
|
24
|
30 return either;
|
23
|
31 }
|
|
32 return DefaultEither.newB(either.b());
|
14
|
33 }
|
103
|
34
|
|
35 @Override
|
|
36 public Either<Error, Logging> edit(TreeNode _e) {
|
|
37 Logging logNode = wrap(_e);
|
|
38 return _edit(logNode);
|
|
39 }
|
|
40
|
|
41 public Logging wrap(TreeNode node) {
|
|
42 return new LoggingNode(node);
|
|
43 }
|
|
44
|
|
45 @Override
|
|
46 public Logging wrap(TreeNode node, OperationLog op) {
|
|
47 return new LoggingNode(node, op);
|
|
48 }
|
|
49
|
|
50 @Override
|
|
51 public TreeMap<String, List<TreeNode>> getIndex() {
|
|
52 // TODO Auto-generated method stub
|
|
53 return null;
|
|
54 }
|
|
55
|
14
|
56 }
|