Improve test cases. Coverage of 85%+ and fix bugs.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / event / types / FloatDeclaration.java
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 *******************************************************************************/
11
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;
27 private final long alignment;
28
29 // ------------------------------------------------------------------------
30 // Constructors
31 // ------------------------------------------------------------------------
32
33 public FloatDeclaration(int exponent, int mantissa, ByteOrder byteOrder,
34 Encoding encoding, long alignment) {
35 mant = mantissa;
36 exp = exponent;
37 this.byteOrder = byteOrder;
38 this.encoding = encoding;
39 this.alignment = alignment;
40
41 }
42
43 // ------------------------------------------------------------------------
44 // Gettters/Setters/Predicates
45 // ------------------------------------------------------------------------
46
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
75 @Override
76 public long getAlignment() {
77 return alignment;
78 }
79
80 // ------------------------------------------------------------------------
81 // Operations
82 // ------------------------------------------------------------------------
83
84 @Override
85 public FloatDefinition createDefinition(IDefinitionScope definitionScope,
86 String fieldName) {
87 return new FloatDefinition(this, definitionScope, fieldName);
88 }
89
90 @Override
91 public String toString() {
92 /* Only used for debugging */
93 return "[declaration] float[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
94 }
95 }
This page took 0.031703 seconds and 5 git commands to generate.