1 15 16 package javassist.bytecode.annotation; 17 18 import javassist.bytecode.ConstPool; 19 import java.io.IOException ; 20 21 28 public class FloatMemberValue extends MemberValue { 29 int valueIndex; 30 31 37 public FloatMemberValue(int index, ConstPool cp) { 38 super('F', cp); 39 this.valueIndex = index; 40 } 41 42 47 public FloatMemberValue(float f, ConstPool cp) { 48 super('F', cp); 49 setValue(f); 50 } 51 52 55 public FloatMemberValue(ConstPool cp) { 56 super('F', cp); 57 setValue(0.0F); 58 } 59 60 63 public float getValue() { 64 return cp.getFloatInfo(valueIndex); 65 } 66 67 70 public void setValue(float newValue) { 71 valueIndex = cp.addFloatInfo(newValue); 72 } 73 74 77 public String toString() { 78 return Float.toString(getValue()); 79 } 80 81 void write(AnnotationsWriter writer) throws IOException { 82 writer.constValueIndex(getValue()); 83 } 84 85 88 public void accept(MemberValueVisitor visitor) { 89 visitor.visitFloatMemberValue(this); 90 } 91 } 92 | Popular Tags |