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 MutableDouble extends Number implements Comparable<MutableDouble> {
16 private static final long serialVersionUID = 1L;
20 public MutableDouble() {}
22 public MutableDouble(double value) { this.value = value; }
24 public boolean isNaN() {
25 return Double.isNaN(value);
28 public boolean isInfinite() {
29 return Double.isInfinite(value);
32 public String toString() {
33 return String.valueOf(value);
36 public byte byteValue() {
40 public short shortValue() {
44 public int intValue() {
48 public long longValue() {
52 public float floatValue() {
56 public double doubleValue() {
57 return (double) value;
60 public int hashCode() {
61 long bits = Double.doubleToLongBits(value);
62 return (int) (bits ^ (bits >>> 32));
65 public boolean equals(Object obj) {
66 return (obj instanceof MutableDouble)
67 && (Double.doubleToLongBits(((MutableDouble) obj).value) == Double
68 .doubleToLongBits(value));
71 public int compareTo(MutableDouble anotherDouble) {
72 return Double.compare(value, anotherDouble.value);