package nl.tudelft.simulation.dsol.interpreter.classfile; import java.io.DataInput; import java.io.IOException; /** * A ConstantFloat. *
* (c) copyright 2002-2014 Delft University of Technology.
* BSD-style license. See DSOL License.
* @author Peter Jacobs
* @author Alexander Verbraeck
*/
public final class ConstantFloat extends Constant
{
/** the value. */
private float bytes;
/**
* constructs a new ConstantFloat.
* @param constantPool the constantPool it is part of
* @param inputStream the inputstream to read from
* @throws IOException on failure
*/
public ConstantFloat(final Constant[] constantPool, final DataInput inputStream) throws IOException
{
this(constantPool, inputStream.readFloat());
}
/**
* constructs a new ConstantFloat.
* @param constantPool the constantPool it is part of
* @param bytes the bytes
*/
public ConstantFloat(final Constant[] constantPool, final float bytes)
{
super(constantPool);
this.bytes = bytes;
}
/** {@inheritDoc} */
@Override
public int getTag()
{
return 4;
}
/**
* returns the value.
* @return float the value
*/
public float getValue()
{
return this.bytes;
}
/** {@inheritDoc} */
@Override
public String toString()
{
return "ConstantFloat[value=" + this.bytes + "]";
}
}