summaryrefslogtreecommitdiff
path: root/NET/worlds/network/SMState.java
blob: 946c77dd52ae43d52fc71372b1873cc9c9eb017e (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
/*    */ package NET.worlds.network;
/*    */ 
/*    */ import NET.worlds.core.IniFile;
/*    */ import java.io.PrintStream;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ class SMState
/*    */ {
/*    */   private int _state;
/*    */   private WorldServer _ws;
/*    */   private static int _debugLevel;
/*    */   
/*    */   static
/*    */   {
/*    */     try
/*    */     {
/* 28 */       _debugLevel = Integer.parseInt(IniFile.gamma().getIniString(
/* 29 */         "netdebug", "0"));
/*    */     } catch (NumberFormatException e) {
/* 31 */       _debugLevel = 0;
/*    */     }
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */   public SMState(WorldServer ws, int state)
/*    */   {
/* 39 */     this._state = state;
/* 40 */     this._ws = ws;
/*    */   }
/*    */   
/*    */   public int getState() {
/* 44 */     return this._state;
/*    */   }
/*    */   
/*    */   public synchronized void setState(int state)
/*    */   {
/* 49 */     if ((_debugLevel & 0x8) > 0) {
/* 50 */       synchronized (System.out) {
/* 51 */         System.out.println(this._ws + ": *** new state: " + state);
/* 52 */         if ((_debugLevel & 0x10) > 0)
/*    */           try {
/* 54 */             throw new InterruptedException();
/*    */           } catch (InterruptedException e) {
/* 56 */             e.printStackTrace(System.out);
/* 57 */             System.out
/* 58 */               .println("******************************");
/*    */           }
/*    */       }
/*    */     }
/* 62 */     this._state = state;
/* 63 */     notifyAll();
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   public synchronized void waitForState(int state)
/*    */     throws InfiniteWaitException
/*    */   {
/* 74 */     while (this._state != state) {
/*    */       try {
/* 76 */         wait();
/*    */       }
/*    */       catch (InterruptedException e)
/*    */       {
/* 80 */         if (!$assertionsDisabled) throw new AssertionError();
/*    */       }
/* 82 */       if (this._state == -1) {
/* 83 */         throw new InfiniteWaitException();
/*    */       }
/*    */     }
/*    */   }
/*    */ }


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