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 StringConstant extends Constant { 37 Utf8Constant name; 38 StringConstant() {} 39 StringConstant(Utf8Constant name) { 40 this.name = name; 41 } 42 void writeTo(DataOutputStream stream) throws IOException { 43 stream.writeByte(STRING_TAG); 44 name.writeIndex(stream); 45 } 46 public String toString() { 47 return rep(getIndex(), 48 "(string " + name + ")"); 49 } 50 public boolean equals(Object other) { 51 if (! (other instanceof StringConstant)) return false; 52 StringConstant o = (StringConstant) other; 53 return name == o.name; 54 } 55 public int hashCode() { 56 return name.hashCode() + STRING_TAG; 57 } 58 59 void readFrom(DataInputStream stream, ConstantPool pool) throws IOException { 60 name = (Utf8Constant) 61 pool.get(stream.readUnsignedShort(), new Utf8Constant()); 62 } 63 } 64 | Popular Tags |