1 18 19 package org.apache.jmeter.testelement.property; 20 21 import org.apache.jmeter.testelement.TestElement; 22 23 26 public class FloatProperty extends NumberProperty 27 { 28 float value; 29 float savedValue; 30 31 public FloatProperty(String name,float value) 32 { 33 super(name); 34 this.value = value; 35 } 36 37 public FloatProperty() 38 { 39 } 40 41 44 public void setRunningVersion(boolean runningVersion) 45 { 46 savedValue = value; 47 super.setRunningVersion(runningVersion); 48 } 49 50 53 public void recoverRunningVersion(TestElement owner) 54 { 55 value = savedValue; 56 } 57 58 public void setValue(float value) 59 { 60 this.value = value; 61 } 62 63 protected void setNumberValue(Number n) 64 { 65 value = n.floatValue(); 66 } 67 68 protected void setNumberValue(String n) throws NumberFormatException 69 { 70 value = Float.parseFloat(n); 71 } 72 73 76 public String getStringValue() 77 { 78 return Float.toString(value); 79 } 80 81 84 public Object getObjectValue() 85 { 86 return new Float (value); 87 } 88 89 92 public Object clone() 93 { 94 FloatProperty prop = (FloatProperty)super.clone(); 95 prop.value = value; 96 return prop; 97 } 98 99 102 public boolean getBooleanValue() 103 { 104 return value > 0 ? true : false; 105 } 106 107 110 public double getDoubleValue() 111 { 112 return (double)value; 113 } 114 115 118 public float getFloatValue() 119 { 120 return value; 121 } 122 123 126 public int getIntValue() 127 { 128 return (int)value; 129 } 130 131 134 public long getLongValue() 135 { 136 return (long)value; 137 } 138 } 139 | Popular Tags |