view src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/transformer/PutAttribute.cs @ 7:02b2ab7bffe6

fix
author Kazuma
date Tue, 27 Sep 2016 18:36:05 +0900
parents dec15de2c6ff
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);
	}
}