Mercurial > hg > Database > jungle-sharp
view Main/jungle-network/operations/NetworkTreeOperation.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 NetworkTreeOperation : TreeOperation { public NetworkNodePath Path; public NetworkNodeOperation Operation; public NetworkTreeOperation (TreeOperation tOp) { this.Path = new NetworkNodePath(tOp.getNodePath()); this.Operation = new NetworkNodeOperation(tOp.getNodeOperation()); } public NetworkTreeOperation(NodePath path, NodeOperation op) { this.Path = new NetworkNodePath(path); this.Operation = new NetworkNodeOperation(op); } public NetworkTreeOperation(NetworkNodePath path, NodeOperation op) { this.Path = path; this.Operation = new NetworkNodeOperation(op); } public NetworkTreeOperation(NodePath path, NetworkNodeOperation op) { this.Path = new NetworkNodePath(path); this.Operation = op; } public NetworkTreeOperation(NetworkNodePath path, NetworkNodeOperation op) { this.Path = path; this.Operation = op; } public NodePath getNodePath () { return this.Path; } public NodeOperation getNodeOperation() { Command c = this.Operation.getCommand(); switch(c){ case Command.PUT_ATTRIBUTE: return new PutAttributeOperation(Operation.getKey(), Operation.getValue()); case Command.APPEND_CHILD: return new AppendChildAtOperation(Operation.getPosition()); case Command.DELETE_CHILD: return new DeleteChildAtOperation(Operation.getPosition()); case Command.DELETE_ATTRIBUTE: return new DeleteAttributeOperation(Operation.getKey()); default: break; } return null; } } }