ctf: java 8 compliance of javadoc
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / event / types / FloatDeclaration.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 java.nio.ByteOrder;
15
16 /**
17 * A CTF float declaration.
18 *
19 * The declaration of a floating point basic data type.
20 *
21 * @version 1.0
22 * @author Matthew Khouzam
23 */
24 public class FloatDeclaration implements IDeclaration {
25
26 // ------------------------------------------------------------------------
27 // Attributes
28 // ------------------------------------------------------------------------
29
30 private final int mant;
31 private final int exp;
32 private final ByteOrder byteOrder;
33 private final long alignment;
34
35 // ------------------------------------------------------------------------
36 // Constructors
37 // ------------------------------------------------------------------------
38
39 /**
40 * Constructor
41 *
42 * @param exponent
43 * The exponent size in bits
44 * @param mantissa
45 * The mantissa size in bits (+1 for sign) (see CTF spec)
46 * @param byteOrder
47 * The byte order
48 * @param alignment
49 * The alignment. Should be ≥ 1
50 */
51 public FloatDeclaration(int exponent, int mantissa, ByteOrder byteOrder,
52 long alignment) {
53 mant = mantissa;
54 exp = exponent;
55 this.byteOrder = byteOrder;
56 this.alignment = Math.max(alignment, 1);
57
58 }
59
60 // ------------------------------------------------------------------------
61 // Getters/Setters/Predicates
62 // ------------------------------------------------------------------------
63
64 /**
65 * @return the mant
66 */
67 public int getMantissa() {
68 return mant;
69 }
70
71 /**
72 * @return the exp
73 */
74 public int getExponent() {
75 return exp;
76 }
77
78 /**
79 * @return the byteOrder
80 */
81 public ByteOrder getByteOrder() {
82 return byteOrder;
83 }
84
85 @Override
86 public long getAlignment() {
87 return alignment;
88 }
89
90 // ------------------------------------------------------------------------
91 // Operations
92 // ------------------------------------------------------------------------
93
94 @Override
95 public FloatDefinition createDefinition(IDefinitionScope definitionScope,
96 String fieldName) {
97 return new FloatDefinition(this, definitionScope, fieldName);
98 }
99
100 @Override
101 public String toString() {
102 /* Only used for debugging */
103 return "[declaration] float[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
104 }
105 }
This page took 0.03885 seconds and 6 git commands to generate.