1 25 41 package org.jgrapht.util; 42 43 65 public class ModifiableInteger 66 extends Number 67 implements Comparable 68 { 69 70 72 private static final long serialVersionUID = 3618698612851422261L; 73 74 76 79 public int value; 80 81 83 93 @Deprecated public ModifiableInteger() 94 { 95 } 96 97 104 public ModifiableInteger(int value) 105 { 106 this.value = value; 107 } 108 109 111 116 public void setValue(int value) 117 { 118 this.value = value; 119 } 120 121 128 public int getValue() 129 { 130 return this.value; 131 } 132 133 136 public void increment() 137 { 138 this.value++; 139 } 140 141 144 public void decrement() 145 { 146 this.value--; 147 } 148 149 163 public int compareTo(ModifiableInteger anotherInteger) 164 { 165 int thisVal = this.value; 166 int anotherVal = anotherInteger.value; 167 168 return (thisVal < anotherVal) ? -1 : ((thisVal == anotherVal) ? 0 : 1); 169 } 170 171 191 public int compareTo(Object o) 192 { 193 return compareTo((ModifiableInteger) o); 194 } 195 196 199 public double doubleValue() 200 { 201 return this.value; 202 } 203 204 215 public boolean equals(Object o) 216 { 217 if (o instanceof ModifiableInteger) { 218 return this.value == ((ModifiableInteger) o).value; 219 } 220 221 return false; 222 } 223 224 227 public float floatValue() 228 { 229 return this.value; 230 } 231 232 239 public int hashCode() 240 { 241 return this.value; 242 } 243 244 247 public int intValue() 248 { 249 return this.value; 250 } 251 252 255 public long longValue() 256 { 257 return this.value; 258 } 259 260 267 public Integer toInteger() 268 { 269 return new Integer (this.value); 270 } 271 272 282 public String toString() 283 { 284 return String.valueOf(this.value); 285 } 286 } 287 | Popular Tags |