1 /*******************************************************************************
2 * Copyright (c) 2010 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.databoard.primitives;
14 public class MutableInteger extends Number implements Comparable<MutableInteger> {
16 private static final long serialVersionUID = 1L;
20 public MutableInteger() {}
22 public MutableInteger(int value) { this.value = value; }
24 public byte byteValue() {
28 public short shortValue() {
32 public int intValue() {
36 public long longValue() {
40 public float floatValue() {
44 public double doubleValue() {
45 return (double) value;
48 public String toString() {
49 return String.valueOf(value);
52 public int hashCode() {
56 public boolean equals(Object obj) {
57 if (obj == null) return false;
58 if (obj == this) return true;
60 if (obj instanceof MutableInteger) {
61 return value == ((MutableInteger) obj).intValue();
66 public int compareTo(MutableInteger anotherInteger) {
67 int thisVal = this.value;
68 int anotherVal = anotherInteger.value;
69 return (thisVal<anotherVal ? -1 : (thisVal==anotherVal ? 0 : 1));