| Home >> All >> com >> techtrader >> modules >> tools >> bytecode >> [ lowlevel Javadoc ] |
Source code: com/techtrader/modules/tools/bytecode/lowlevel/DoubleEntry.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 * Representation of a constant double value in the constant pool. 14 * 15 * @author Abe White 16 */ 17 public class DoubleEntry 18 implements ConstantEntry, LowLevelConstants 19 { 20 private double _value = 0.0; 21 22 23 public int getType () 24 { 25 return ENTRY_DOUBLE; 26 } 27 28 29 /** 30 * Get the value of the constant. 31 */ 32 public double getValue () 33 { 34 return _value; 35 } 36 37 38 /** 39 * Set the value of the constant. 40 */ 41 public void setValue (double value) 42 { 43 _value = value; 44 } 45 46 47 public Object getConstantValue () 48 { 49 return new Double (_value); 50 } 51 52 53 public void setConstantValue (Object val) 54 { 55 _value = ((Number) val).doubleValue (); 56 } 57 58 59 public void readData (DataInput in) 60 throws IOException 61 { 62 setValue (in.readDouble ()); 63 } 64 65 66 public void writeData (DataOutput out) 67 throws IOException 68 { 69 out.writeDouble (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.enterDoubleEntry (this); 82 visit.exitDoubleEntry (this); 83 } 84 }