Mercurial > hg > Members > tatsuki > bench > jungle-core
annotate src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/trasnformer/AppendChildAt.java @ 79:b4f145174970
change log
author | one |
---|---|
date | Sun, 31 Aug 2014 02:10:14 +0900 |
parents | 540a27dde42f |
children | 715a9fbf02fc |
rev | line source |
---|---|
14 | 1 package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer; |
2 | |
78 | 3 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; |
79 | 4 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.DefaultOperationLog; |
5 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.OperationLog; | |
6 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.AppendChildAtOperation; | |
7 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; | |
23 | 8 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither; |
9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; | |
24 | 10 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; |
23 | 11 |
29 | 12 public class AppendChildAt implements NodeEditor |
14 | 13 { |
14 private final int pos; | |
15 | |
16 public AppendChildAt(int _pos) | |
17 { | |
18 pos = _pos; | |
19 } | |
20 | |
21 @Override | |
78 | 22 public <T extends TreeNode<T>> Either<Error,T> edit(T _e) |
14 | 23 { |
31
418088ca2b30
added Generics parameters to EditableNode framework
Shoshi TAMAKI
parents:
29
diff
changeset
|
24 Either<Error,T> either = _e.getChildren().addNewChildAt(pos); |
23 | 25 if(either.isA()){ |
26 // error | |
24 | 27 return either; |
23 | 28 } |
29 | |
30 return DefaultEither.newB(either.b()); | |
14 | 31 } |
79 | 32 |
33 @Override | |
34 public OperationLog getLog() { | |
35 OperationLog op = new DefaultOperationLog(); | |
36 NodeOperation addNewChildAt = new AppendChildAtOperation(pos); | |
37 op = op.add(addNewChildAt); | |
38 return op; | |
39 } | |
14 | 40 } |