using UnityEngine; 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; } } }