diff options
Diffstat (limited to 'NET/worlds/scape/DPState.java')
| -rw-r--r-- | NET/worlds/scape/DPState.java | 221 |
1 files changed, 221 insertions, 0 deletions
diff --git a/NET/worlds/scape/DPState.java b/NET/worlds/scape/DPState.java new file mode 100644 index 0000000..c5df105 --- /dev/null +++ b/NET/worlds/scape/DPState.java @@ -0,0 +1,221 @@ +/* */ package NET.worlds.scape; +/* */ +/* */ import java.io.IOException; +/* */ import java.util.Enumeration; +/* */ import java.util.Vector; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class DPState +/* */ extends SuperRoot +/* */ { +/* */ public static final int INFINITY = 60000; +/* 44 */ protected Vector<Object> connections = new Vector(); +/* */ +/* */ +/* 47 */ protected int currentDist = 60000; +/* */ +/* */ +/* 50 */ protected long currentTime = 0L; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public DPState(int dist, DPAction conn) +/* */ { +/* 61 */ this.currentDist = dist; +/* 62 */ this.currentTime = 0L; +/* 63 */ addConnection(conn); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public DPState() {} +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void setDist(int d, int t) +/* */ { +/* 82 */ if (this.currentTime > t) +/* 83 */ return; +/* 84 */ if ((this.currentDist <= d) && (this.currentTime == t)) { +/* 85 */ return; +/* */ } +/* 87 */ this.currentDist = d; +/* 88 */ this.currentTime = t; +/* */ +/* */ +/* 91 */ Enumeration<Object> e = this.connections.elements(); +/* 92 */ while (e.hasMoreElements()) { +/* 93 */ ((DPAction)e.nextElement()).handleDist(d, t); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public int getDist() +/* */ { +/* 102 */ return this.currentDist; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public Enumeration<Object> getConnections() +/* */ { +/* 111 */ return this.connections.elements(); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public Enumeration<SuperRoot> getPortals() +/* */ { +/* 120 */ Vector<SuperRoot> v = new Vector(this.connections.size()); +/* 121 */ Enumeration<Object> e = this.connections.elements(); +/* 122 */ while (e.hasMoreElements()) +/* 123 */ v.addElement(((DPAction)e.nextElement()).getOwner()); +/* 124 */ return v.elements(); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void addConnection(DPAction conn) +/* */ { +/* 134 */ if (this.connections.contains(conn)) { +/* 135 */ return; +/* */ } +/* 137 */ this.connections.addElement(conn); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void dropConnection(DPAction conn) +/* */ { +/* 147 */ this.connections.removeElement(conn); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public Object properties(int index, int offset, int mode, Object value) +/* */ throws NoSuchPropertyException +/* */ { +/* 157 */ Object ret = null; +/* 158 */ switch (index - offset) { +/* */ case 0: +/* 160 */ if (mode == 0) { +/* 161 */ ret = IntegerPropertyEditor.make( +/* 162 */ new Property(this, index, "Current Distance")); +/* 163 */ } else if (mode == 1) { +/* 164 */ ret = new Integer(this.currentDist); +/* 165 */ } else if (mode == 2) +/* 166 */ this.currentDist = ((Integer)value).intValue(); +/* 167 */ break; +/* */ case 1: +/* 169 */ if (mode == 0) { +/* 170 */ ret = new VectorProperty(this, index, "Connections"); +/* 171 */ } else if (mode == 1) +/* 172 */ ret = this.connections.clone(); +/* 173 */ break; +/* */ default: +/* 175 */ ret = super.properties(index, offset + 2, mode, value); +/* */ } +/* 177 */ return ret; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* 184 */ private static Object classCookie = new Object(); +/* */ +/* */ public void saveState(Saver s) throws IOException +/* */ { +/* 188 */ s.saveVersion(0, classCookie); +/* 189 */ super.saveState(s); +/* 190 */ s.saveVector(this.connections); +/* 191 */ s.saveInt(this.currentDist); +/* */ } +/* */ +/* */ public void restoreState(Restorer r) throws IOException, TooNewException +/* */ { +/* 196 */ switch (r.restoreVersion(classCookie)) { +/* */ case 0: +/* 198 */ super.restoreState(r); +/* 199 */ this.connections = r.restoreVector(); +/* 200 */ this.currentDist = r.restoreInt(); +/* 201 */ break; +/* */ default: +/* 203 */ throw new TooNewException(); +/* */ } +/* */ +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public String toString() +/* */ { +/* 213 */ return super.getName(); +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\DPState.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |