summaryrefslogtreecommitdiff
path: root/NET/worlds/console/StatNetMUNode.java
blob: ede89ea158bae66b32b0ba3997f7ab50651eb2fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*     */ package NET.worlds.console;
/*     */ 
/*     */ import NET.worlds.core.Std;
/*     */ import java.awt.List;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class StatNetMUNode
/*     */   extends StatMan
/*     */   implements MainCallback
/*     */ {
/*  19 */   private static StatNetMUNode _singleInstance = new StatNetMUNode();
/*     */   private int _totBytesSent;
/*     */   
/*  22 */   public static StatNetMUNode getNode() { return _singleInstance; }
/*     */   
/*     */   private StatNetMUNode()
/*     */   {
/*  26 */     StatNetNode.getNode().addChild(this);
/*     */   }
/*     */   
/*     */   public String toString()
/*     */   {
/*  31 */     return "Multiuser Server Connections";
/*     */   }
/*     */   
/*     */   private int _totBytesRcvd;
/*     */   private int _totPacketsSent;
/*     */   private int _totPacketsRcvd;
/*     */   private int _lastTime;
/*     */   private static final int TITLE = 0;
/*     */   public void addBytesSent(int bytesSent) {
/*  40 */     this._totBytesSent += bytesSent;
/*     */   }
/*     */   
/*     */   public void addBytesRcvd(int bytesRcvd) {
/*  44 */     this._totBytesRcvd += bytesRcvd;
/*     */   }
/*     */   
/*     */   public void addPacketsSent(int pktSent) {
/*  48 */     this._totPacketsSent += pktSent;
/*     */   }
/*     */   
/*     */   public void addPacketsRcvd(int pktRcvd) {
/*  52 */     this._totPacketsRcvd += pktRcvd;
/*     */   }
/*     */   
/*     */   void grabList(List list)
/*     */   {
/*  57 */     super.grabList(list);
/*  58 */     Main.register(this);
/*     */   }
/*     */   
/*     */   void releaseList(boolean terminalCallback)
/*     */   {
/*  63 */     if (!terminalCallback)
/*  64 */       Main.unregister(this);
/*  65 */     super.releaseList(terminalCallback);
/*     */   }
/*     */   
/*     */   public void mainCallback() {
/*  69 */     int thisTime = Std.getFastTime();
/*  70 */     if (thisTime - this._lastTime > 1000) {
/*  71 */       updateList();
/*  72 */       this._lastTime = thisTime;
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */   private static final int BLANK1 = 1;
/*     */   
/*     */   private static final int TOTBYTESSENT = 2;
/*     */   private static final int TOTBYTESRCVD = 3;
/*     */   private static final int BLANK2 = 4;
/*     */   private static final int TOTPKTSSENT = 5;
/*     */   private static final int TOTPKTSRCVD = 6;
/*     */   void createList()
/*     */   {
/*  86 */     this._grabbedList.add("Overall Multiuser Server Network Statistics:", 
/*  87 */       0);
/*  88 */     this._grabbedList.add("", 1);
/*  89 */     this._grabbedList.add("      Total bytes sent: " + this._totBytesSent + 
/*  90 */       " bytes", 2);
/*  91 */     this._grabbedList.add("Total bytes received: " + this._totBytesRcvd + 
/*  92 */       " bytes", 3);
/*  93 */     this._grabbedList.add("", 4);
/*  94 */     this._grabbedList.add("      Total packets sent: " + this._totPacketsSent + 
/*  95 */       " packets", 5);
/*  96 */     this._grabbedList.add("Total packets received: " + this._totPacketsRcvd + 
/*  97 */       " packets", 6);
/*     */   }
/*     */   
/*     */   void updateList()
/*     */   {
/* 102 */     this._grabbedList.replaceItem("      Total bytes sent: " + this._totBytesSent + 
/* 103 */       " bytes", 2);
/* 104 */     this._grabbedList.replaceItem("Total bytes received: " + this._totBytesRcvd + 
/* 105 */       " bytes", 3);
/* 106 */     this._grabbedList.replaceItem("      Total packets sent: " + this._totPacketsSent + 
/* 107 */       " packets", 5);
/* 108 */     this._grabbedList.replaceItem("Total packets received: " + this._totPacketsRcvd + 
/* 109 */       " packets", 6);
/*     */   }
/*     */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\StatNetMUNode.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */