Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/techtrader/modules/tools/bytecode/lowlevel/FloatEntry.java


1   package com.techtrader.modules.tools.bytecode.lowlevel;
2   
3   
4   import java.io.DataInput;
5   import java.io.DataOutput;
6   import java.io.IOException;
7   import java.io.PrintWriter;
8   
9   import com.techtrader.modules.tools.bytecode.visitor.BCVisitor;
10  
11  
12  /**
13   *  Represents a constant float value in the constant pool.
14   *  
15   *  @author    Abe White
16   */
17  public class FloatEntry
18    implements ConstantEntry, LowLevelConstants
19  {
20    private float _value = 0.0F;
21  
22  
23    public int getType ()
24    {
25      return ENTRY_FLOAT;
26    }
27  
28  
29    /**
30     *  Return the value of this constant.  
31      */
32    public float getValue ()
33    {
34      return _value;
35    }
36  
37  
38    /**
39     *  Set the value of this constant.  
40      */
41    public void setValue (float value)
42    {
43      _value = value;
44    }
45  
46  
47    public Object getConstantValue ()
48    {
49      return new Float (_value);
50    }
51  
52  
53    public void setConstantValue (Object val)
54    {
55      _value = ((Number) val).floatValue ();
56    }
57  
58  
59    public void readData (DataInput in)
60      throws IOException
61    {
62      setValue (in.readFloat ());
63    }
64  
65  
66    public void writeData (DataOutput out)
67      throws IOException
68    {
69      out.writeFloat (getValue ());
70    }
71  
72  
73    public String getKey ()
74    {
75      return getType () + "|" + getValue ();
76    }
77  
78  
79    public void acceptVisit (BCVisitor visit)
80    {
81      visit.enterFloatEntry (this);
82      visit.exitFloatEntry (this);
83    }
84  }