summaryrefslogtreecommitdiff
path: root/NET/worlds/console/StatNetRefNode.java
blob: 7466a049ed95961c33728aa1dccbf9e98b441c19 (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
118
/*     */ package NET.worlds.console;
/*     */ 
/*     */ import NET.worlds.core.Std;
/*     */ import NET.worlds.network.NetworkRoom;
/*     */ import NET.worlds.network.WorldServer;
/*     */ import NET.worlds.scape.Pilot;
/*     */ import NET.worlds.scape.Room;
/*     */ import java.awt.List;
/*     */ import java.util.Vector;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class StatNetRefNode
/*     */   extends StatMan
/*     */   implements MainCallback
/*     */ {
/*  22 */   private static StatNetRefNode _singleInstance = new StatNetRefNode();
/*     */   private int _totBytesSent;
/*     */   
/*  25 */   public static StatNetRefNode getNode() { return _singleInstance; }
/*     */   
/*     */   private int _totBytesRcvd;
/*     */   private int _totPacketsSent;
/*  29 */   private StatNetRefNode() { StatNetNode.getNode().addChild(this); }
/*     */   
/*     */ 
/*     */   public String toString()
/*     */   {
/*  34 */     return "Drone Referrers to Current Server";
/*     */   }
/*     */   
/*     */   private int _totPacketsRcvd;
/*     */   private int _lastTime;
/*     */   private static final int TITLE = 0;
/*     */   private static final int BLANK = 1;
/*     */   public void addBytesSent(int bytesSent)
/*     */   {
/*  43 */     this._totBytesSent += bytesSent;
/*     */   }
/*     */   
/*     */   public void addBytesRcvd(int bytesRcvd) {
/*  47 */     this._totBytesRcvd += bytesRcvd;
/*     */   }
/*     */   
/*     */   public void addPacketsSent(int pktSent) {
/*  51 */     this._totPacketsSent += pktSent;
/*     */   }
/*     */   
/*     */   public void addPacketsRcvd(int pktRcvd) {
/*  55 */     this._totPacketsRcvd += pktRcvd;
/*     */   }
/*     */   
/*     */   void grabList(List list)
/*     */   {
/*  60 */     super.grabList(list);
/*  61 */     Main.register(this);
/*     */   }
/*     */   
/*     */   void releaseList(boolean terminalCallback)
/*     */   {
/*  66 */     if (!terminalCallback)
/*  67 */       Main.unregister(this);
/*  68 */     super.releaseList(terminalCallback);
/*     */   }
/*     */   
/*     */   public void mainCallback() {
/*  72 */     int thisTime = Std.getFastTime();
/*  73 */     if (thisTime - this._lastTime > 1000) {
/*  74 */       updateList();
/*  75 */       this._lastTime = thisTime;
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   void createList()
/*     */   {
/*  85 */     this._grabbedList.add("Drones Referring to Current Server:", 0);
/*  86 */     this._grabbedList.add("", 1);
/*     */     
/*  88 */     Pilot p = Pilot.getActive();
/*  89 */     Room r = p.getRoom();
/*  90 */     NetworkRoom netRoom = null;
/*  91 */     if (r != null)
/*  92 */       netRoom = r.getNetworkRoom();
/*  93 */     WorldServer ws = null;
/*  94 */     if (netRoom != null)
/*  95 */       ws = netRoom.getServer();
/*  96 */     if (ws != null) {
/*  97 */       Vector<String> list = ws.printDroneReferrers();
/*  98 */       for (int i = list.size() - 1; i >= 0; i--) {
/*  99 */         String name = (String)list.elementAt(i);
/* 100 */         this._grabbedList.add(name);
/*     */       }
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   void updateList()
/*     */   {
/* 109 */     this._grabbedList.removeAll();
/* 110 */     createList();
/*     */   }
/*     */ }


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