aa6d6db27de8607bdf127a65090d73138ecd6678
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / event / types / FloatDefinition.java
1 /*******************************************************************************
2 * Copyright (c) 2011, 2013 Ericsson, Ecole Polytechnique de Montreal and others
3 *
4 * All rights reserved. This program and the accompanying materials are made
5 * 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: Matthew Khouzam - Initial API and implementation
10 *******************************************************************************/
11
12 package org.eclipse.linuxtools.ctf.core.event.types;
13
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.eclipse.linuxtools.ctf.core.event.scope.IDefinitionScope;
16
17 /**
18 * A CTF float definition.
19 *
20 * The definition of a floating point basic data type. It will take the data
21 * from a trace and store it (and make it fit) as a double.
22 *
23 * @version 1.0
24 * @author Matthew Khouzam
25 * @author Simon Marchi
26 */
27 public final class FloatDefinition extends Definition {
28 // ------------------------------------------------------------------------
29 // Attributes
30 // ------------------------------------------------------------------------
31
32 private final double fValue;
33
34 // ------------------------------------------------------------------------
35 // Constructors
36 // ------------------------------------------------------------------------
37
38 /**
39 * Constructor
40 *
41 * @param declaration
42 * the parent declaration
43 * @param definitionScope
44 * the parent scope
45 * @param fieldName
46 * the field name
47 * @param value
48 * field value
49 * @since 3.0
50 */
51 public FloatDefinition(@NonNull FloatDeclaration declaration,
52 IDefinitionScope definitionScope, @NonNull String fieldName, double value) {
53 super(declaration, definitionScope, fieldName);
54 fValue = value;
55 }
56
57 // ------------------------------------------------------------------------
58 // Getters/Setters/Predicates
59 // ------------------------------------------------------------------------
60
61 /**
62 * The value of a float stored, fit into a double. This should be extended
63 * for exotic floats if this is necessary.
64 *
65 * @return the value of the float field fit into a double.
66 */
67 public double getValue() {
68 return fValue;
69 }
70
71 @Override
72 public FloatDeclaration getDeclaration() {
73 return (FloatDeclaration) super.getDeclaration();
74 }
75
76 // ------------------------------------------------------------------------
77 // Operations
78 // ------------------------------------------------------------------------
79
80 @Override
81 public String toString() {
82 return String.valueOf(fValue);
83 }
84 }
This page took 0.036785 seconds and 4 git commands to generate.