1 18 19 package org.apache.jmeter.testelement.property; 20 21 import org.apache.jmeter.testelement.TestElement; 22 23 24 27 public class LongProperty extends NumberProperty 28 { 29 long value; 30 long savedValue; 31 32 public LongProperty(String name, long value) 33 { 34 super(name); 35 this.value = value; 36 } 37 38 public LongProperty() 39 { 40 super(); 41 } 42 43 46 public void setRunningVersion(boolean runningVersion) 47 { 48 savedValue = value; 49 super.setRunningVersion(runningVersion); 50 } 51 52 55 public void recoverRunningVersion(TestElement owner) 56 { 57 value = savedValue; 58 } 59 60 public void setValue(int value) 61 { 62 this.value = value; 63 } 64 65 protected void setNumberValue(Number n) 66 { 67 value = n.longValue(); 68 } 69 70 protected void setNumberValue(String n) throws NumberFormatException 71 { 72 value = Long.parseLong(n); 73 } 74 75 78 public String getStringValue() 79 { 80 return Long.toString(value); 81 } 82 83 86 public Object getObjectValue() 87 { 88 return new Long (value); 89 } 90 91 94 public Object clone() 95 { 96 LongProperty prop = (LongProperty) super.clone(); 97 prop.value = value; 98 return prop; 99 } 100 101 104 public boolean getBooleanValue() 105 { 106 return getLongValue() > 0 ? true : false; 107 } 108 109 112 public double getDoubleValue() 113 { 114 return (double) value; 115 } 116 117 120 public float getFloatValue() 121 { 122 return (float) value; 123 } 124 125 128 public int getIntValue() 129 { 130 return (int) value; 131 } 132 133 136 public long getLongValue() 137 { 138 return value; 139 } 140 } 141 | Popular Tags |