view Main/jungle-main/store/transformer/PutAttribute.cs @ 29:f7616084d3ab

Continue to put on the created path.
author Kazuma Takeda
date Wed, 18 Jan 2017 21:02:24 +0900
parents 1f99e150f336
children 1466993c104c
line wrap: on
line source

using UnityEngine;
using System.Collections;

namespace JungleDB {
	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);
		}
	}
 }