Mercurial > hg > Database > jungle-sharp
diff src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/PutAttribute.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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/store/transformer/PutAttribute.cs Sun Oct 23 07:40:50 2016 +0900 @@ -0,0 +1,36 @@ +using UnityEngine; +using System.Collections; + +public class PutAttribute : NodeEditor { + private string key; + private byte[] value; + + public PutAttribute(string _key, byte[] _value) + { + key = _key; + value = _value; + } + + public Either<Error,LoggingNode> _edit(LoggingNode _e) + { + Either<Error,LoggingNode> either = _e.getAttributes().put(key,value); + if(either.isA()){ + // error + return either; + } + return DefaultEither<Error, LoggingNode>.newB(either.b()); + } + + public Either<Error, LoggingNode> edit(TreeNode _e) { + LoggingNode logNode = wrap(_e); + return _edit(logNode); + } + + public LoggingNode wrap(TreeNode node) { + return new LoggingNode(node); + } + + public LoggingNode wrap(TreeNode node, OperationLog op) { + return new LoggingNode(node, op); + } +}