35
|
1 using System.Collections;
|
20
|
2
|
|
3 namespace JungleDB {
|
|
4 public class DeleteChildAt : NodeEditor {
|
|
5 private int pos;
|
|
6
|
|
7 public DeleteChildAt(int _pos)
|
|
8 {
|
|
9 pos = _pos;
|
|
10 }
|
|
11
|
|
12 public Either<Error, LoggingNode> _edit(LoggingNode logNode)
|
|
13 {
|
|
14 Either<Error,LoggingNode> either = logNode.getChildren().deleteChildAt(pos);
|
|
15 if(either.isA()){
|
|
16 // error
|
|
17 return either;
|
|
18 }
|
|
19 return DefaultEither<Error, LoggingNode>.newB(either.b());
|
|
20 }
|
|
21
|
|
22 public Either<Error, LoggingNode> edit(TreeNode _e) {
|
|
23 LoggingNode logNode = wrap(_e);
|
|
24 return _edit(logNode);
|
|
25 }
|
|
26
|
|
27 public LoggingNode wrap(TreeNode node) {
|
|
28 return new LoggingNode(node);
|
|
29 }
|
|
30
|
|
31 public LoggingNode wrap(TreeNode node, OperationLog op) {
|
|
32 return new LoggingNode(node, op);
|
|
33 }
|
|
34 }
|
|
35 } |