Mercurial > hg > Database > jungle-sharp
diff src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperation.cs @ 17:01a08cf4b2d9
Liq Files
author | Kazuma |
---|---|
date | Mon, 07 Nov 2016 01:05:24 +0900 |
parents | b71d9ea6bd8e |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperation.cs Mon Nov 07 01:05:24 2016 +0900 @@ -0,0 +1,54 @@ +using UnityEngine; +using System.Collections; + +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; + } +}