diff Main/jungle-main/store/transformer/AppendChildAt.cs @ 20:1f99e150f336

fix folder and add Object Mapper.
author Kazuma Takeda
date Thu, 15 Dec 2016 22:52:48 +0900
parents
children f2ea780b3e80
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Main/jungle-main/store/transformer/AppendChildAt.cs	Thu Dec 15 22:52:48 2016 +0900
@@ -0,0 +1,35 @@
+using UnityEngine;
+using System.Collections;
+
+namespace JungleDB {
+	public class AppendChildAt : NodeEditor {
+		private int pos;
+
+		public AppendChildAt(int _pos){
+			pos = _pos;
+		}
+
+		public Either<Error, LoggingNode> _edit(LoggingNode _e) 
+		{
+			Either<Error,LoggingNode> either = _e.getChildren().addNewChildAt(pos);
+			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);
+		}
+	}
+}