comparison src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperation.cs @ 12:b71d9ea6bd8e

Add Network Operation Class. this codes can not test yet.
author Kazuma
date Sun, 23 Oct 2016 12:25:57 +0900
parents
children
comparison
equal deleted inserted replaced
11:220433691c2e 12:b71d9ea6bd8e
1 using UnityEngine;
2 using System.Collections;
3
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 }