1 16 17 package org.cojen.classfile.constant; 18 19 import java.io.DataOutput ; 20 import java.io.IOException ; 21 import org.cojen.classfile.ConstantInfo; 22 import org.cojen.classfile.ConstantPool; 23 24 30 public class ConstantDoubleInfo extends ConstantInfo { 31 private final double mValue; 32 33 public ConstantDoubleInfo(double value) { 34 super(TAG_DOUBLE); 35 mValue = value; 36 } 37 38 public double getValue() { 39 return mValue; 40 } 41 42 public int hashCode() { 43 long bits = Double.doubleToLongBits(mValue); 44 return (int)(bits ^ (bits >>> 32)); 45 } 46 47 public boolean equals(Object obj) { 48 if (this == obj) { 49 return true; 50 } 51 if (obj instanceof ConstantDoubleInfo) { 52 ConstantDoubleInfo other = (ConstantDoubleInfo)obj; 53 return mValue == other.mValue; 54 } 55 return false; 56 } 57 58 protected int getEntryCount() { 59 return 2; 60 } 61 62 public void writeTo(DataOutput dout) throws IOException { 63 super.writeTo(dout); 64 dout.writeDouble(mValue); 65 } 66 67 public String toString() { 68 return "CONSTANT_Double_info: " + mValue; 69 } 70 } 71 | Popular Tags |