1 24 25 package org.aspectj.compiler.base.bcg.pool; 26 27 import org.aspectj.compiler.base.bcg.*; 28 29 import java.io.*; 30 import java.util.*; 31 32 import org.aspectj.compiler.base.ast.ArrayType; 33 import org.aspectj.compiler.base.ast.NameType; 34 import org.aspectj.compiler.base.ast.RefType; 35 36 public class FloatConstant extends Constant { 37 float value; 38 FloatConstant() {} 39 FloatConstant(float value) { 40 this.value = value; 41 } 42 void writeTo(DataOutputStream stream) throws IOException { 43 stream.writeByte(FLOAT_TAG); 44 stream.writeFloat(value); 45 } 46 public String toString() { 47 return rep(getIndex(), 48 "(float " + value + ")"); 49 } 50 public boolean equals(Object other) { 51 if (! (other instanceof FloatConstant)) return false; 52 FloatConstant o = (FloatConstant) other; 53 return value == o.value; 54 } 55 public int hashCode() { 56 return (int)(value * 3); 57 } 58 59 void readFrom(DataInputStream stream, ConstantPool pool) throws IOException { 60 value = stream.readFloat(); 61 } 62 } 63 | Popular Tags |