20
|
1 using UnityEngine;
|
|
2 using System.Collections;
|
|
3
|
|
4 namespace JungleDB {
|
|
5 public class AppendChildAt : NodeEditor {
|
|
6 private int pos;
|
|
7
|
|
8 public AppendChildAt(int _pos){
|
|
9 pos = _pos;
|
|
10 }
|
|
11
|
|
12 public Either<Error, LoggingNode> _edit(LoggingNode _e)
|
|
13 {
|
|
14 Either<Error,LoggingNode> either = _e.getChildren().addNewChildAt(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 }
|