Remove unneeded checkNotNull() calls
[deliverable/tracecompass.git] / ctf / org.eclipse.tracecompass.ctf.core / src / org / eclipse / tracecompass / ctf / core / event / types / FloatDefinition.java
1 /*******************************************************************************
2 * Copyright (c) 2011, 2014 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.tracecompass.ctf.core.event.types;
13
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.eclipse.tracecompass.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 */
50 public FloatDefinition(@NonNull FloatDeclaration declaration,
51 IDefinitionScope definitionScope, @NonNull String fieldName, double value) {
52 super(declaration, definitionScope, fieldName);
53 fValue = value;
54 }
55
56 // ------------------------------------------------------------------------
57 // Getters/Setters/Predicates
58 // ------------------------------------------------------------------------
59
60 /**
61 * The value of a float stored, fit into a double. This should be extended
62 * for exotic floats if this is necessary.
63 *
64 * @return the value of the float field fit into a double.
65 */
66 public double getValue() {
67 return fValue;
68 }
69
70 @Override
71 public FloatDeclaration getDeclaration() {
72 return (FloatDeclaration) super.getDeclaration();
73 }
74
75 // ------------------------------------------------------------------------
76 // Operations
77 // ------------------------------------------------------------------------
78
79 @Override
80 public String toString() {
81 return String.valueOf(fValue);
82 }
83 }
This page took 0.031731 seconds and 5 git commands to generate.