view 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 source

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);
	}
}