view Main/jungle-main/store/transformer/DeleteChildAt.cs @ 41:bd44baa491a9 default tip

add TestJungleCore.cs
author Kazuma Takeda
date Thu, 23 Feb 2017 17:19:55 +0900
parents f2ea780b3e80
children
line wrap: on
line source

using System.Collections;

namespace JungleDB {
	public class DeleteChildAt : NodeEditor {
		private int pos;

		public DeleteChildAt(int _pos)
		{
			pos = _pos;
		}

		public Either<Error, LoggingNode> _edit(LoggingNode logNode)
		{
			Either<Error,LoggingNode> either = logNode.getChildren().deleteChildAt(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);
		}
	}
}