summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/Sensor.java
blob: 47d0a6fb5df63de46dc72efc096e2faac16b1f2d (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/*     */ package NET.worlds.scape;
/*     */ 
/*     */ import java.io.IOException;
/*     */ import java.io.PrintStream;
/*     */ import java.util.Enumeration;
/*     */ import java.util.Vector;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class Sensor
/*     */   extends SuperRoot
/*     */ {
/*  70 */   protected Vector<Action> actions = new Vector();
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public void addAction(Action o)
/*     */   {
/*  82 */     this.actions.addElement(o);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public void deleteAction(Action o)
/*     */   {
/*  93 */     this.actions.removeElement(o);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public void deleteActions()
/*     */   {
/* 100 */     while (this.actions.size() > 0) {
/* 101 */       deleteAction((Action)this.actions.elementAt(0));
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */   public Enumeration<Action> getActions()
/*     */   {
/* 108 */     return this.actions.elements();
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public int countActions()
/*     */   {
/* 115 */     return this.actions.size();
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public void trigger(Event event)
/*     */   {
/* 126 */     RunningActionHandler.trigger(this.actions, getWorld(), event);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public Object properties(int index, int offset, int mode, Object value)
/*     */     throws NoSuchPropertyException
/*     */   {
/* 136 */     Object ret = null;
/* 137 */     switch (index - offset) {
/*     */     case 0: 
/* 139 */       if (mode == 0) {
/* 140 */         ret = ObjectPropertyAdder.make(new VectorProperty(this, index, 
/* 141 */           "Targets"), getRoot(), "NET.worlds.scape.Action");
/* 142 */       } else if (mode == 1) {
/* 143 */         ret = this.actions.clone();
/* 144 */       } else if (mode == 4) {
/* 145 */         deleteAction((Action)value);
/* 146 */       } else if (mode == 3)
/* 147 */         addAction((Action)value);
/* 148 */       break;
/*     */     default: 
/* 150 */       ret = super.properties(index, offset + 1, mode, value);
/*     */     }
/* 152 */     return ret;
/*     */   }
/*     */   
/*     */ 
/* 156 */   private static Object classCookie = new Object();
/*     */   
/*     */   public void saveState(Saver s) throws IOException {
/* 159 */     s.saveVersion(2, classCookie);
/* 160 */     super.saveState(s);
/* 161 */     s.saveVector(this.actions);
/*     */   }
/*     */   
/*     */   public void restoreState(Restorer r) throws IOException, TooNewException {
/* 165 */     restoreStateVers(r);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   protected int restoreStateVers(Restorer r)
/*     */     throws IOException, TooNewException
/*     */   {
/* 175 */     int vers = r.restoreVersion(classCookie);
/*     */     
/* 177 */     switch (vers) {
/*     */     case 1: 
/*     */     case 2: 
/* 180 */       super.restoreState(r);
/*     */     case 0: 
/* 182 */       this.actions = r.restoreVectorActions();
/* 183 */       break;
/*     */     default: 
/* 185 */       throw new TooNewException();
/*     */     }
/*     */     
/* 188 */     return vers;
/*     */   }
/*     */   
/*     */   public void postRestore(int version) {
/* 192 */     super.postRestore(version);
/* 193 */     for (Enumeration<Action> en = getActions(); en.hasMoreElements();) {
/* 194 */       Action a = (Action)en.nextElement();
/* 195 */       if ((getOwner() != null) && (a.getOwner() == null)) {
/* 196 */         System.out.println("Reparenting orphan action " + a.getName());
/* 197 */         WObject w = (WObject)getOwner();
/* 198 */         w.addAction(a);
/*     */       }
/*     */     }
/*     */   }
/*     */ }


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