comparison src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperationLog.cs @ 17:01a08cf4b2d9

Liq Files
author Kazuma
date Mon, 07 Nov 2016 01:05:24 +0900
parents
children
comparison
equal deleted inserted replaced
16:8f1ce942abfc 17:01a08cf4b2d9
1 using UnityEngine;
2 using System.Collections;
3 using System.Collections.Generic;
4 using System;
5 public class NetworkTreeOperationLog : TreeOperationLog {
6
7 public LinkedList<NetworkTreeOperation> list;
8 public int Size;
9 public string Uuid;
10 public string TreeName;
11 public long TimeStamp;
12
13
14 public NetworkTreeOperationLog () {
15 list = new LinkedList<NetworkTreeOperation>();
16 this.Size = 0;
17 this.TreeName = "";
18 this.TimeStamp = DateTime.Now.ToBinary();
19 }
20
21 public NetworkTreeOperationLog(string uid, string name, IEnumerable<TreeOperation> _list) {
22 this.list = new LinkedList<NetworkTreeOperation>();
23 this.Uuid = uid;
24 this.Size = 0;
25 this.TreeName = name;
26 this.TimeStamp = DateTime.Now.ToBinary();
27 foreach(var op in _list) {
28 NetworkTreeOperation nOp = new NetworkTreeOperation(op);
29 this.list.AddLast(nOp);
30 }
31 this.Size = this.list.Count;
32 }
33
34 public NetworkTreeOperationLog (string uid, string name, IEnumerable<TreeOperation> _list, long timestamp) {
35 this.Uuid = uid;
36 this.TreeName = name;
37 this.list = new LinkedList<NetworkTreeOperation>();
38 this.Size = 0;
39 this.TimeStamp = timestamp;
40 foreach(var op in _list) {
41 NetworkTreeOperation nOp = new NetworkTreeOperation(op);
42 this.list.AddLast(nOp);
43 }
44 this.Size = this.list.Count;
45 }
46
47 public NetworkTreeOperationLog (IEnumerable<TreeOperation> _list) {
48 this.Uuid = "";
49 this.TreeName = "";
50 this.list = new LinkedList<NetworkTreeOperation>();
51 this.Size = 0;
52 this.TimeStamp = DateTime.Now.ToBinary();
53 foreach(var op in _list) {
54 NetworkTreeOperation nOp = new NetworkTreeOperation(op);
55 this.list.AddLast(nOp);
56 }
57 this.Size = this.list.Count;
58 }
59
60 IEnumerator IEnumerable.GetEnumerator()
61 {
62 return this.GetEnumerator();
63 }
64
65 public IEnumerator<TreeOperation> GetEnumerator()
66 {
67 foreach(NetworkTreeOperation l in list){
68 yield return l;
69 }
70 }
71
72
73 public TreeOperationLog add (NodePath path, NodeOperation op) {
74 NetworkTreeOperation nOp = new NetworkTreeOperation(path, op);
75 this.list.AddLast(nOp);
76 this.Size = list.Count;
77 return this;
78 }
79
80 public TreeOperationLog append (TreeOperationLog log) {
81 foreach(TreeOperation o in log) {
82 NetworkTreeOperation op = new NetworkTreeOperation(o);
83 this.list.AddLast(op);
84 }
85 this.Size = list.Count;
86 return this;
87 }
88
89 public int length () {
90 return this.list.Count;
91 }
92
93 public string getUuid() {
94 return Uuid;
95 }
96
97 public string getTreeName () {
98 return TreeName;
99 }
100
101 public long getTimeStamp () {
102 return TimeStamp;
103 }
104
105 public void setTimeStamp (long timestamp) {
106 this.TimeStamp = timestamp;
107 }
108
109 }