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 MutableFloat extends Number implements Comparable<MutableFloat> {
16 private static final long serialVersionUID = 1L;
20 public MutableFloat() {}
22 public MutableFloat(float value) { this.value = value; }
24 public boolean isNaN() {
25 return Float.isNaN(value);
28 public boolean isInfinite() {
29 return Float.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() {
60 public int hashCode() {
61 return Float.floatToIntBits(value);
64 public boolean equals(Object obj) {
65 if (obj == null) return false;
66 if (obj == this) return true;
68 return (obj instanceof MutableFloat)
69 && (Float.floatToIntBits(((MutableFloat)obj).value) == Float.floatToIntBits(value));
72 public int compareTo(MutableFloat anotherFloat) {
73 return Float.compare(value, anotherFloat.value);