35
|
1 using System.Collections;
|
20
|
2
|
|
3 namespace JungleDB {
|
|
4 public class NetworkTreeOperation : TreeOperation {
|
|
5
|
|
6 public NetworkNodePath Path;
|
|
7 public NetworkNodeOperation Operation;
|
|
8
|
|
9 public NetworkTreeOperation (TreeOperation tOp) {
|
|
10 this.Path = new NetworkNodePath(tOp.getNodePath());
|
|
11 this.Operation = new NetworkNodeOperation(tOp.getNodeOperation());
|
|
12 }
|
|
13
|
|
14 public NetworkTreeOperation(NodePath path, NodeOperation op) {
|
|
15 this.Path = new NetworkNodePath(path);
|
|
16 this.Operation = new NetworkNodeOperation(op);
|
|
17 }
|
|
18
|
|
19 public NetworkTreeOperation(NetworkNodePath path, NodeOperation op) {
|
|
20 this.Path = path;
|
|
21 this.Operation = new NetworkNodeOperation(op);
|
|
22 }
|
|
23
|
|
24 public NetworkTreeOperation(NodePath path, NetworkNodeOperation op) {
|
|
25 this.Path = new NetworkNodePath(path);
|
|
26 this.Operation = op;
|
|
27 }
|
|
28
|
|
29 public NetworkTreeOperation(NetworkNodePath path, NetworkNodeOperation op) {
|
|
30 this.Path = path;
|
|
31 this.Operation = op;
|
|
32 }
|
|
33
|
|
34 public NodePath getNodePath () {
|
|
35 return this.Path;
|
|
36 }
|
|
37
|
|
38 public NodeOperation getNodeOperation() {
|
|
39 Command c = this.Operation.getCommand();
|
|
40 switch(c){
|
|
41 case Command.PUT_ATTRIBUTE:
|
|
42 return new PutAttributeOperation(Operation.getKey(), Operation.getValue());
|
|
43 case Command.APPEND_CHILD:
|
|
44 return new AppendChildAtOperation(Operation.getPosition());
|
|
45 case Command.DELETE_CHILD:
|
|
46 return new DeleteChildAtOperation(Operation.getPosition());
|
|
47 case Command.DELETE_ATTRIBUTE:
|
|
48 return new DeleteAttributeOperation(Operation.getKey());
|
|
49 default:
|
|
50 break;
|
|
51 }
|
|
52 return null;
|
|
53 }
|
|
54 }
|
|
55 }
|