1 18 19 package org.apache.jmeter.testelement.property; 20 21 import org.apache.jmeter.testelement.TestElement; 22 23 26 public class IntegerProperty extends NumberProperty 27 { 28 int value; 29 int savedValue; 30 31 public IntegerProperty(String name, int value) 32 { 33 super(name); 34 this.value = value; 35 } 36 37 40 public void setRunningVersion(boolean runningVersion) 41 { 42 savedValue = value; 43 super.setRunningVersion(runningVersion); 44 } 45 46 49 public void recoverRunningVersion(TestElement owner) 50 { 51 value = savedValue; 52 } 53 54 public IntegerProperty(String name) 55 { 56 super(name); 57 } 58 59 public IntegerProperty() 60 { 61 super(); 62 } 63 64 public void setValue(int value) 65 { 66 this.value = value; 67 } 68 69 protected void setNumberValue(Number n) 70 { 71 value = n.intValue(); 72 } 73 74 protected void setNumberValue(String n) throws NumberFormatException 75 { 76 value = Integer.parseInt(n); 77 } 78 79 82 public String getStringValue() 83 { 84 return Integer.toString(value); 85 } 86 87 90 public Object getObjectValue() 91 { 92 return new Integer (value); 93 } 94 95 98 public Object clone() 99 { 100 IntegerProperty prop = (IntegerProperty) super.clone(); 101 prop.value = value; 102 return prop; 103 } 104 105 108 public boolean getBooleanValue() 109 { 110 return getIntValue() > 0 ? true : false; 111 } 112 113 116 public double getDoubleValue() 117 { 118 return (double) value; 119 } 120 121 124 public float getFloatValue() 125 { 126 return (float) value; 127 } 128 129 132 public int getIntValue() 133 { 134 return value; 135 } 136 137 140 public long getLongValue() 141 { 142 return (long) value; 143 } 144 } 145 | Popular Tags |