Mercurial > hg > Database > jungle-sharp
comparison src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/impl/logger/LoggingNode.cs @ 10:abe0c247f5a5
Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
author | Kazuma Takeda <kazuma-arashi@hotmail.co.jp> |
---|---|
date | Sun, 23 Oct 2016 07:40:50 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:e6ad9016601c | 10:abe0c247f5a5 |
---|---|
1 using UnityEngine; | |
2 using System.Collections; | |
3 | |
4 public class LoggingNode { | |
5 private TreeNode wrap; | |
6 private OperationLog log; | |
7 | |
8 public LoggingNode(TreeNode _wrap) | |
9 : this(_wrap,new DefaultOperationLog()) | |
10 { | |
11 } | |
12 | |
13 public LoggingNode(TreeNode _wrap,OperationLog _log) | |
14 { | |
15 wrap = _wrap; | |
16 log = _log; | |
17 } | |
18 | |
19 public LoggingAttributes getAttributes() | |
20 { | |
21 return new LoggingAttributes(wrap,log); | |
22 } | |
23 | |
24 public LoggingChildren getChildren() | |
25 { | |
26 Debug.Log ("in gtChildren"); | |
27 return new LoggingChildren(wrap,log); | |
28 } | |
29 | |
30 | |
31 public OperationLog getOperationLog() | |
32 { | |
33 return log; | |
34 } | |
35 | |
36 public Either<Error, LoggingNode> replaceNewRootNode() { | |
37 NodeOperation replaceRootNode = new ReplaceRootNodeOperation(); | |
38 return edit(replaceRootNode); | |
39 } | |
40 | |
41 public Either<Error, LoggingNode> edit(NodeOperation op){ | |
42 Either<Error,TreeNode> either = op.invoke(wrap); | |
43 if(either.isA()){ | |
44 return DefaultEither<Error, LoggingNode>.newA(either.a()); | |
45 } | |
46 | |
47 TreeNode newWrap = either.b(); | |
48 OperationLog newLog = log.add(op); | |
49 LoggingNode newLoggingNode = new LoggingNode(newWrap,newLog); | |
50 return DefaultEither<Error, LoggingNode>.newB(newLoggingNode); | |
51 } | |
52 | |
53 public TreeNode getWrap() | |
54 { | |
55 return wrap; | |
56 } | |
57 | |
58 } |