Commit | Line | Data |
---|---|---|
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 | ||
13 | package org.eclipse.linuxtools.tmf.core.statevalue; | |
14 | ||
15 | /** | |
16 | * A state value containing a double primitive. | |
17 | * | |
18 | * @author Alexandre Montplaisir | |
19 | */ | |
20 | final class DoubleStateValue extends TmfStateValue { | |
21 | ||
22 | private final double valueDouble; | |
23 | ||
24 | public DoubleStateValue(double value) { | |
25 | valueDouble = value; | |
26 | } | |
27 | ||
28 | @Override | |
29 | public Type getType() { | |
ec5fec10 | 30 | return Type.DOUBLE; |
a3c22e8e AM |
31 | } |
32 | ||
33 | @Override | |
34 | public boolean isNull() { | |
35 | return false; | |
36 | } | |
37 | ||
38 | @Override | |
39 | public Double getValue() { | |
40 | return valueDouble; | |
41 | } | |
42 | ||
43 | @Override | |
44 | public String toString() { | |
45 | return String.format("%3f", valueDouble); //$NON-NLS-1$ | |
46 | } | |
47 | ||
48 | // ------------------------------------------------------------------------ | |
49 | // Unboxing methods | |
50 | // ------------------------------------------------------------------------ | |
51 | ||
52 | @Override | |
53 | public double unboxDouble() { | |
54 | return valueDouble; | |
55 | } | |
56 | } |