]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/src/org/simantics/databoard/primitives/MutableFloat.java
Added addFirst/After/Before + remove SCL functions for Ordered Sets
[simantics/platform.git] / bundles / org.simantics.databoard / src / org / simantics / databoard / primitives / MutableFloat.java
1 /*******************************************************************************
2  *  Copyright (c) 2010 Association for Decentralized Information Management in
3  *  Industry THTH ry.
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
8  *
9  *  Contributors:
10  *      VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.databoard.primitives;
13
14 public class MutableFloat extends Number implements Comparable<MutableFloat> {
15
16         private static final long serialVersionUID = 1L;
17         
18         public float value;
19
20         public MutableFloat() {}
21         
22         public MutableFloat(float value) { this.value = value; }
23         
24     public boolean isNaN() {
25         return Float.isNaN(value);
26     }
27
28     public boolean isInfinite() {
29         return Float.isInfinite(value);
30     }
31
32     public String toString() {
33         return String.valueOf(value);
34     }
35
36     public byte byteValue() {
37         return (byte)value;
38     }
39
40     public short shortValue() {
41         return (short)value;
42     }
43
44     public int intValue() {
45         return (int)value;
46     }
47
48     public long longValue() {
49         return (long)value;
50     }
51
52     public float floatValue() {
53         return value;
54     }
55
56     public double doubleValue() {
57         return (double)value;
58     }
59
60     public int hashCode() {
61         return Float.floatToIntBits(value);
62     }
63     
64     public boolean equals(Object obj) {
65                 if (obj == null) return false;
66                 if (obj == this) return true;
67                 
68                 return (obj instanceof MutableFloat)
69                && (Float.floatToIntBits(((MutableFloat)obj).value) == Float.floatToIntBits(value));
70     }
71     
72     public int compareTo(MutableFloat anotherFloat) {
73         return Float.compare(value, anotherFloat.value);
74     }    
75         
76 }
77