comparison Main/jungle-network/operations/NetworkTreeOperation.cs @ 20:1f99e150f336

fix folder and add Object Mapper.
author Kazuma Takeda
date Thu, 15 Dec 2016 22:52:48 +0900
parents
children f2ea780b3e80
comparison
equal deleted inserted replaced
19:0865819106cf 20:1f99e150f336
1 using UnityEngine;
2 using System.Collections;
3
4 namespace JungleDB {
5 public class NetworkTreeOperation : TreeOperation {
6
7 public NetworkNodePath Path;
8 public NetworkNodeOperation Operation;
9
10 public NetworkTreeOperation (TreeOperation tOp) {
11 this.Path = new NetworkNodePath(tOp.getNodePath());
12 this.Operation = new NetworkNodeOperation(tOp.getNodeOperation());
13 }
14
15 public NetworkTreeOperation(NodePath path, NodeOperation op) {
16 this.Path = new NetworkNodePath(path);
17 this.Operation = new NetworkNodeOperation(op);
18 }
19
20 public NetworkTreeOperation(NetworkNodePath path, NodeOperation op) {
21 this.Path = path;
22 this.Operation = new NetworkNodeOperation(op);
23 }
24
25 public NetworkTreeOperation(NodePath path, NetworkNodeOperation op) {
26 this.Path = new NetworkNodePath(path);
27 this.Operation = op;
28 }
29
30 public NetworkTreeOperation(NetworkNodePath path, NetworkNodeOperation op) {
31 this.Path = path;
32 this.Operation = op;
33 }
34
35 public NodePath getNodePath () {
36 return this.Path;
37 }
38
39 public NodeOperation getNodeOperation() {
40 Command c = this.Operation.getCommand();
41 switch(c){
42 case Command.PUT_ATTRIBUTE:
43 return new PutAttributeOperation(Operation.getKey(), Operation.getValue());
44 case Command.APPEND_CHILD:
45 return new AppendChildAtOperation(Operation.getPosition());
46 case Command.DELETE_CHILD:
47 return new DeleteChildAtOperation(Operation.getPosition());
48 case Command.DELETE_ATTRIBUTE:
49 return new DeleteAttributeOperation(Operation.getKey());
50 default:
51 break;
52 }
53 return null;
54 }
55 }
56 }