view Main/jungle-network/operations/NetworkPutAttributeOperation.cs @ 31:1466993c104c

byte[] to object Rewrite.
author Kazuma Takeda
date Fri, 20 Jan 2017 07:08:03 +0900
parents 1f99e150f336
children f2ea780b3e80
line wrap: on
line source

using UnityEngine;
using System.Collections;

namespace JungleDB {
	public class NetworkPutAttributeOperation : NodeOperation {

		public string Key;
		public object Value;

		public NetworkPutAttributeOperation() {
			this.Key = null;
			this.Value = null;
		}

		public NetworkPutAttributeOperation(string key, byte[] value){
			this.Key = key;
			this.Value = value;
		}

		public Command getCommand () {
			return Command.PUT_ATTRIBUTE;
		}

		public Either<Error, TreeNode> invoke (TreeNode target) {
			return target.getAttributes().put(this.Key, this.Value);
		}

		public string getKey () {
			return this.Key;
		}

		public int getPosition () {
			return -1;
		}

		public object getValue () {
			return this.Value;
		}
	}
}