]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/src/org/simantics/databoard/primitives/MutableLong.java
Added addFirst/After/Before + remove SCL functions for Ordered Sets
[simantics/platform.git] / bundles / org.simantics.databoard / src / org / simantics / databoard / primitives / MutableLong.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 MutableLong extends Number implements Comparable<MutableLong> {
15
16         private static final long serialVersionUID = 1L;
17         
18         public long value;
19         
20         public MutableLong() {}
21         
22         public MutableLong(long value) { this.value = value; }
23
24         public byte byteValue() {
25                 return (byte) value;
26         }
27
28         public short shortValue() {
29                 return (short) value;
30         }
31
32         public int intValue() {
33                 return (int) value;
34         }
35
36         public long longValue() {
37                 return (long) value;
38         }
39
40         public float floatValue() {
41                 return (float) value;
42         }
43
44         public double doubleValue() {
45                 return (double) value;
46         }
47
48         public String toString() {
49                 return String.valueOf(value);
50         }
51
52         public int hashCode() {
53                 return (int) (value ^ (value >>> 32));
54         }
55
56         public boolean equals(Object obj) {
57                 if (obj == null) return false;
58                 if (obj == this) return true;
59                 
60                 if (obj instanceof MutableLong) {
61                         return value == ((MutableLong) obj).longValue();
62                 }
63                 return false;
64         }
65
66         public int compareTo(MutableLong anotherLong) {
67                 long thisVal = this.value;
68                 long anotherVal = anotherLong.value;
69                 return (thisVal < anotherVal ? -1 : (thisVal == anotherVal ? 0 : 1));
70         }
71         
72 }