tmf: Split the state system in a separate plugin
[deliverable/tracecompass.git] / org.eclipse.linuxtools.statesystem.core / src / org / eclipse / linuxtools / statesystem / core / statevalue / LongStateValue.java
1 /*******************************************************************************
2 * Copyright (c) 2013 École Polytechnique de Montréal
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8
9 * Contributors:
10 * François Rajotte - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.statesystem.core.statevalue;
14
15 import org.eclipse.jdt.annotation.Nullable;
16
17 /**
18 * A state value containing a long integer (8 bytes).
19 *
20 * @version 1.0
21 * @author François Rajotte
22 */
23 final class LongStateValue extends TmfStateValue {
24
25 private final long value;
26
27 public LongStateValue(long valueAsLong) {
28 this.value = valueAsLong;
29 }
30
31 @Override
32 public Type getType() {
33 return Type.LONG;
34 }
35
36 @Override
37 public boolean isNull() {
38 return false;
39 }
40 @Override
41 public boolean equals(@Nullable Object object) {
42 if (!(object instanceof LongStateValue)) {
43 return false;
44 }
45 LongStateValue other = (LongStateValue) object;
46 return (this.value == other.value);
47 }
48
49 @Override
50 public int hashCode() {
51 return ((int) value) ^ ((int) (value >>> 32));
52 }
53
54 @Override
55 public @Nullable String toString() {
56 return String.format("%3d", value); //$NON-NLS-1$
57 }
58
59 // ------------------------------------------------------------------------
60 // Unboxing methods
61 // ------------------------------------------------------------------------
62
63 @Override
64 public long unboxLong() {
65 return value;
66 }
67 }
This page took 0.035319 seconds and 5 git commands to generate.