1 /*******************************************************************************
2 * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
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
9 * Contributors: Matthew Khouzam - Initial API and implementation
10 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.ctf
.core
.event
.types
;
14 import java
.nio
.ByteOrder
;
19 * @author Matthew Khouzam
22 public class FloatDeclaration
implements IDeclaration
{
24 // ------------------------------------------------------------------------
26 // ------------------------------------------------------------------------
28 private final int mant
;
29 private final int exp
;
30 private final ByteOrder byteOrder
;
31 private final long alignment
;
33 // ------------------------------------------------------------------------
35 // ------------------------------------------------------------------------
39 * @param exponent the exponent size in bits
40 * @param mantissa the mantissa size in bits (+1 for sign) (see ctf spec)
41 * @param byteOrder the byte order
42 * @param alignment the alignment
44 public FloatDeclaration(int exponent
, int mantissa
, ByteOrder byteOrder
,
48 this.byteOrder
= byteOrder
;
49 this.alignment
= alignment
;
53 // ------------------------------------------------------------------------
54 // Gettters/Setters/Predicates
55 // ------------------------------------------------------------------------
60 public int getMantissa() {
67 public int getExponent() {
72 * @return the byteOrder
74 public ByteOrder
getByteOrder() {
79 public long getAlignment() {
83 // ------------------------------------------------------------------------
85 // ------------------------------------------------------------------------
88 public FloatDefinition
createDefinition(IDefinitionScope definitionScope
,
90 return new FloatDefinition(this, definitionScope
, fieldName
);
94 public String
toString() {
95 /* Only used for debugging */
96 return "[declaration] float[" + Integer
.toHexString(hashCode()) + ']'; //$NON-NLS-1$