1 30 31 46 package jbet; 47 import java.io.*; 48 49 class CpInteger extends CpEntry { 50 int value; 51 52 CpInteger(int i, CPInterface cp) { 53 super(i, CPInterface.CONSTANT_Integer, cp); 54 } 55 56 CpInteger (CPInterface cp, int val) { 57 super(cp.poolCount(), CPInterface.CONSTANT_Integer, cp); 58 value = val; 59 } 60 61 public String toString() { 62 return String.valueOf(value); 63 } 64 public int hashCode() { 65 return 17 * value; 66 } 67 68 public boolean equals(Object o) { 69 return (o instanceof CpInteger) && ((CpInteger)o).value == value; 70 } 71 72 void write(DataOutputStream dataOut) throws IOException { 73 dataOut.writeByte(tag); 74 dataOut.writeInt(value); 75 } 76 } 77 | Popular Tags |