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