/* */ package NET.worlds.scape; /* */ /* */ import java.io.DataInputStream; /* */ import java.io.DataOutputStream; /* */ import java.io.IOException; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class NumberAttribute /* */ extends Attribute /* */ { /* */ public NumberAttribute(int attrID) /* */ { /* 23 */ super(attrID); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* 31 */ float value = 0.0F; /* */ /* */ /* */ /* */ public NumberAttribute() {} /* */ /* */ /* */ public void set(float x) /* */ { /* 40 */ this.value = x; /* */ /* 42 */ noteChange(); /* */ } /* */ /* */ public float get() /* */ { /* 47 */ return this.value; /* */ } /* */ /* */ public void generateNetData(DataOutputStream s) /* */ throws IOException /* */ { /* 53 */ s.writeFloat(this.value); /* */ } /* */ /* */ public void setFromNetData(DataInputStream ds, int len) throws IOException /* */ { /* 58 */ this.value = ds.readFloat(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public Object properties(int index, int offset, int mode, Object value) /* */ throws NoSuchPropertyException /* */ { /* 68 */ Object ret = null; /* 69 */ switch (index - offset) { /* */ case 0: /* 71 */ if (mode == 0) { /* 72 */ ret = FloatPropertyEditor.make( /* 73 */ new Property(this, index, "value")); /* 74 */ } else if (mode == 1) { /* 75 */ ret = new Float(get()); /* 76 */ } else if (mode == 2) /* 77 */ set(((Float)value).floatValue()); /* 78 */ break; /* */ default: /* 80 */ ret = super.properties(index, offset + 1, mode, value); /* */ } /* 82 */ return ret; /* */ } /* */ /* */ /* 86 */ private static Object classCookie = new Object(); /* */ /* */ public void saveState(Saver s) throws IOException /* */ { /* 90 */ s.saveVersion(0, classCookie); /* 91 */ super.saveState(s); /* */ /* 93 */ s.saveFloat(this.value); /* */ } /* */ /* */ public void restoreState(Restorer r) throws IOException, TooNewException /* */ { /* 98 */ switch (r.restoreVersion(classCookie)) { /* */ case 0: /* 100 */ super.restoreState(r); /* 101 */ this.value = r.restoreFloat(); /* 102 */ break; /* */ default: /* 104 */ throw new TooNewException(); /* */ } /* */ /* 107 */ set(this.value); /* */ } /* */ /* */ public String toString() /* */ { /* 112 */ return super.toString() + "[" + get() + "]"; /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\NumberAttribute.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */