annotate src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodePath.cs @ 13:4c8932dad7b2

Add Test and only NetworkTreeOperationLogTest.cs not work.
author Kazuma
date Sun, 23 Oct 2016 13:35:21 +0900
parents b71d9ea6bd8e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
1 using UnityEngine;
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
2 using System.Collections;
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
3 using System.Collections.Generic;
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
4
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
5 public class NetworkNodePath : NodePath {
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
6 LinkedList<int> Path;
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
7
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
8 public NetworkNodePath () {
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
9 Path = new LinkedList<int>();
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
10 Path.AddFirst(-1);
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
11 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
12
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
13 public NetworkNodePath (NodePath path){
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
14 Path = new LinkedList<int>();
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
15 foreach(int p in path) {
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
16 Path.AddLast(p);
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
17 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
18 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
19
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
20 private NetworkNodePath (LinkedList<int> path) {
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
21 this.Path = path;
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
22 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
23
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
24 IEnumerator IEnumerable.GetEnumerator()
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
25 {
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
26 return this.GetEnumerator();
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
27 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
28
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
29 public IEnumerator<int> GetEnumerator()
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
30 {
13
4c8932dad7b2 Add Test and only NetworkTreeOperationLogTest.cs not work.
Kazuma
parents: 12
diff changeset
31 yield return this.Path.GetEnumerator().Current;
12
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
32 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
33
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
34 public NodePath add (int pos) {
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
35 LinkedList<int> newPath = copyPath();
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
36 newPath.AddLast(pos);
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
37 return new NetworkNodePath(newPath);
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
38 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
39
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
40 public NodePath addHead(int pos) { // still java code.
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
41 LinkedList<int> newPath = copyPath();
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
42 newPath.AddFirst(pos);
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
43 return new NetworkNodePath(newPath);
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
44 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
45
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
46 public Pair<int, NodePath> pop () {
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
47 LinkedList<int> cPath = copyPath();
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
48 int e = cPath.First.Value;
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
49 cPath.RemoveFirst();
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
50 return new Pair<int, NodePath>(e, new NetworkNodePath(cPath));
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
51 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
52
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
53 public int size () {
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
54 return this.Path.Count;
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
55 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
56
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
57
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
58 public LinkedList<int> copyPath(){
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
59 LinkedList<int> newPath = new LinkedList<int>();
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
60 foreach(int i in this.Path) {
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
61 newPath.AddLast(i);
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
62 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
63 return newPath;
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
64 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
65
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
66 public override string ToString () {
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
67 return Path.ToString();
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
68 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
69
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
70 public NodePath tail() {
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
71 this.Path.RemoveLast();
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
72 return new NetworkNodePath(this.Path);
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
73 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
74
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
75 public Pair<int, NodePath> last () {
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
76 int lastValue = this.Path.Last.Value;
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
77 this.Path.RemoveLast();
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
78 return new Pair<int, NodePath>(lastValue, new NetworkNodePath(this.Path));
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
79 }
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
80
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
81
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
82
b71d9ea6bd8e Add Network Operation Class. this codes can not test yet.
Kazuma
parents:
diff changeset
83 }