Merge branch 'master' into luna
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / statevalue / DoubleStateValue.java
CommitLineData
a3c22e8e
AM
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
13package org.eclipse.linuxtools.tmf.core.statevalue;
14
75d2d348
AM
15import org.eclipse.jdt.annotation.Nullable;
16
a3c22e8e
AM
17/**
18 * A state value containing a double primitive.
19 *
20 * @author Alexandre Montplaisir
21 */
22final class DoubleStateValue extends TmfStateValue {
23
75d2d348 24 private final Double valueDouble;
a3c22e8e
AM
25
26 public DoubleStateValue(double value) {
75d2d348 27 valueDouble = new Double(value);
a3c22e8e
AM
28 }
29
30 @Override
31 public Type getType() {
ec5fec10 32 return Type.DOUBLE;
a3c22e8e
AM
33 }
34
35 @Override
36 public boolean isNull() {
37 return false;
38 }
39
40 @Override
41 public Double getValue() {
42 return valueDouble;
43 }
44
45 @Override
75d2d348 46 public @Nullable String toString() {
a3c22e8e
AM
47 return String.format("%3f", valueDouble); //$NON-NLS-1$
48 }
49
50 // ------------------------------------------------------------------------
51 // Unboxing methods
52 // ------------------------------------------------------------------------
53
54 @Override
55 public double unboxDouble() {
56 return valueDouble;
57 }
58}
This page took 0.032706 seconds and 5 git commands to generate.