ctf: Don't include all test traces in jar
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / statevalue / DoubleStateValue.java
1 /*******************************************************************************
2 * Copyright (c) 2013 Ericsson
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 * Alexandre Montplaisir - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.tmf.core.statevalue;
14
15 import org.eclipse.jdt.annotation.Nullable;
16
17 /**
18 * A state value containing a double primitive.
19 *
20 * @author Alexandre Montplaisir
21 */
22 final class DoubleStateValue extends TmfStateValue {
23
24 private final double value;
25
26 public DoubleStateValue(double value) {
27 this.value = value;
28 }
29
30 @Override
31 public Type getType() {
32 return Type.DOUBLE;
33 }
34
35 @Override
36 public boolean isNull() {
37 return false;
38 }
39
40 @Override
41 public boolean equals(@Nullable Object object) {
42 if (!(object instanceof DoubleStateValue)) {
43 return false;
44 }
45 DoubleStateValue other = (DoubleStateValue) object;
46 return (Double.compare(this.value, other.value) == 0);
47 }
48
49 @Override
50 public int hashCode() {
51 long bits = Double.doubleToLongBits(value);
52 return ((int) bits) ^ ((int) (bits >>> 32));
53 }
54
55 @Override
56 public @Nullable String toString() {
57 return String.format("%3f", value); //$NON-NLS-1$
58 }
59
60 // ------------------------------------------------------------------------
61 // Unboxing methods
62 // ------------------------------------------------------------------------
63
64 @Override
65 public double unboxDouble() {
66 return value;
67 }
68 }
This page took 0.040016 seconds and 5 git commands to generate.