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