diff options
Diffstat (limited to 'NET/worlds/console/BlackBoxCommand.java')
| -rw-r--r-- | NET/worlds/console/BlackBoxCommand.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/NET/worlds/console/BlackBoxCommand.java b/NET/worlds/console/BlackBoxCommand.java new file mode 100644 index 0000000..6f4f5eb --- /dev/null +++ b/NET/worlds/console/BlackBoxCommand.java @@ -0,0 +1,59 @@ +/* */ package NET.worlds.console; +/* */ +/* */ import NET.worlds.core.Std; +/* */ import java.io.DataInputStream; +/* */ import java.io.DataOutputStream; +/* */ import java.io.IOException; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public abstract class BlackBoxCommand +/* */ { +/* */ int commandType; +/* */ long startTime; +/* */ BlackBoxCallback callback; +/* 19 */ boolean waiting = false; +/* */ +/* */ void timestamp(long basetime) { +/* 22 */ this.startTime = (Std.getFastTime() - basetime); +/* */ } +/* */ +/* */ public boolean execute(BlackBoxCallback c) { +/* 26 */ if (this.waiting) { +/* 27 */ return false; +/* */ } +/* 29 */ this.callback = c; +/* 30 */ if (c != null) { +/* 31 */ this.waiting = true; +/* */ } +/* 33 */ return execute(); +/* */ } +/* */ +/* */ abstract boolean execute(); +/* */ +/* */ void save(DataOutputStream dos) throws IOException { +/* 39 */ dos.writeInt(this.commandType); +/* 40 */ dos.writeLong(this.startTime); +/* */ } +/* */ +/* */ void load(DataInputStream dis) throws IOException { +/* 44 */ this.startTime = dis.readLong(); +/* */ } +/* */ +/* */ void doCallback(boolean ok) { +/* 48 */ if (this.callback != null) { +/* 49 */ this.waiting = false; +/* 50 */ this.callback.commandCompleted(this, ok); +/* */ } +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\BlackBoxCommand.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |