20
|
1 using UnityEngine;
|
|
2 using System.Collections;
|
|
3
|
|
4 namespace JungleDB {
|
|
5 public class PutAttribute : NodeEditor {
|
|
6 private string key;
|
|
7 private byte[] value;
|
|
8
|
|
9 public PutAttribute(string _key, byte[] _value)
|
|
10 {
|
|
11 key = _key;
|
|
12 value = _value;
|
|
13 }
|
|
14
|
|
15 public Either<Error,LoggingNode> _edit(LoggingNode _e)
|
|
16 {
|
|
17 Either<Error,LoggingNode> either = _e.getAttributes().put(key,value);
|
|
18 if(either.isA()){
|
|
19 // error
|
|
20 return either;
|
|
21 }
|
|
22 return DefaultEither<Error, LoggingNode>.newB(either.b());
|
|
23 }
|
|
24
|
|
25 public Either<Error, LoggingNode> edit(TreeNode _e) {
|
|
26 LoggingNode logNode = wrap(_e);
|
|
27 return _edit(logNode);
|
|
28 }
|
|
29
|
|
30 public LoggingNode wrap(TreeNode node) {
|
|
31 return new LoggingNode(node);
|
|
32 }
|
|
33
|
|
34 public LoggingNode wrap(TreeNode node, OperationLog op) {
|
|
35 return new LoggingNode(node, op);
|
|
36 }
|
|
37 }
|
|
38 }
|