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