1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.interpreter.classfile;
11
12 import java.io.DataInput;
13 import java.io.IOException;
14
15 /***
16 * A ConstantFloat <br>
17 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
18 * University of Technology </a>, the Netherlands. <br>
19 * See for project information <a
20 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
21 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
22 * License (GPL) </a>, no warranty <br>
23 *
24 * @version 1.0 Jan 9, 2004 <br>
25 * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
26 * Jacobs </a>
27 */
28 public class ConstantFloat extends Constant
29 {
30 /*** the value */
31 private float bytes;
32
33 /***
34 * constructs a new ConstantFloat
35 *
36 * @param constantPool the constantPool it is part of
37 * @param inputStream the inputstream to read from
38 * @throws IOException on failure
39 */
40 public ConstantFloat(final Constant[] constantPool,
41 final DataInput inputStream) throws IOException
42 {
43 this(constantPool, inputStream.readInt());
44 }
45
46 /***
47 * constructs a new ConstantFloat
48 *
49 * @param constantPool the constantPool it is part of
50 * @param bytes the bytes
51 */
52 public ConstantFloat(final Constant[] constantPool, final float bytes)
53 {
54 super(constantPool);
55 this.bytes = bytes;
56 }
57
58 /***
59 * @see nl.tudelft.simulation.dsol.interpreter.classfile.Constant#getTag()
60 */
61 public int getTag()
62 {
63 return 4;
64 }
65
66 /***
67 * returns the value
68 *
69 * @return float the value
70 */
71 public float getValue()
72 {
73 return this.bytes;
74 }
75
76 /***
77 * @see java.lang.Object#toString()
78 */
79 public String toString()
80 {
81 return "ConstantFloat[value=" + this.bytes + "]";
82 }
83 }