Commit | Line | Data |
---|---|---|
53047a66 MK |
1 | /******************************************************************************* |
2 | * Copyright (c) 2011-2012 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 | *******************************************************************************/ | |
fd74e6c1 | 11 | |
53047a66 MK |
12 | package org.eclipse.linuxtools.ctf.core.event.types; |
13 | ||
14 | import java.nio.ByteOrder; | |
15 | ||
16 | ||
17 | public class FloatDeclaration implements IDeclaration { | |
18 | ||
19 | // ------------------------------------------------------------------------ | |
20 | // Attributes | |
21 | // ------------------------------------------------------------------------ | |
22 | ||
23 | private final int mant; | |
24 | private final int exp; | |
25 | private final ByteOrder byteOrder; | |
26 | private final Encoding encoding; | |
fd74e6c1 | 27 | private final long alignment; |
53047a66 MK |
28 | |
29 | // ------------------------------------------------------------------------ | |
30 | // Constructors | |
31 | // ------------------------------------------------------------------------ | |
32 | ||
33 | public FloatDeclaration(int exponent, int mantissa, ByteOrder byteOrder, | |
fd74e6c1 | 34 | Encoding encoding, long alignment) { |
53047a66 MK |
35 | mant = mantissa; |
36 | exp = exponent; | |
37 | this.byteOrder = byteOrder; | |
38 | this.encoding = encoding; | |
fd74e6c1 | 39 | this.alignment = alignment; |
53047a66 MK |
40 | |
41 | } | |
42 | ||
43 | // ------------------------------------------------------------------------ | |
44 | // Gettters/Setters/Predicates | |
45 | // ------------------------------------------------------------------------ | |
46 | ||
53047a66 MK |
47 | /** |
48 | * @return the mant | |
49 | */ | |
50 | public int getMantissa() { | |
51 | return mant; | |
52 | } | |
53 | ||
54 | /** | |
55 | * @return the exp | |
56 | */ | |
57 | public int getExponent() { | |
58 | return exp; | |
59 | } | |
60 | ||
61 | /** | |
62 | * @return the byteOrder | |
63 | */ | |
64 | public ByteOrder getByteOrder() { | |
65 | return byteOrder; | |
66 | } | |
67 | ||
68 | /** | |
69 | * @return the encoding | |
70 | */ | |
71 | public Encoding getEncoding() { | |
72 | return encoding; | |
73 | } | |
74 | ||
fd74e6c1 MK |
75 | public long getAlignment() { |
76 | return alignment; | |
77 | } | |
78 | ||
53047a66 MK |
79 | // ------------------------------------------------------------------------ |
80 | // Operations | |
81 | // ------------------------------------------------------------------------ | |
82 | ||
83 | @Override | |
84 | public Definition createDefinition(IDefinitionScope definitionScope, | |
85 | String fieldName) { | |
86 | return new FloatDefinition(this, definitionScope, fieldName); | |
87 | } | |
88 | ||
89 | @Override | |
90 | public String toString() { | |
91 | /* Only used for debugging */ | |
92 | return "[declaration] float[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$ | |
93 | } | |
94 | } |