001 package sysModel.classFile.constantPool;
002
003 import sysModel.classFile.constantPool.visitors.IPoolInfoVisitor;
004
005 import java.io.DataInputStream;
006 import java.io.IOException;
007
008 /**
009 * Represents CONSTANT_Utf8_ASCII data in the constant pool.
010 *
011 * @author Mathias Ricken
012 */
013 public class ASCIIPoolInfo extends AUTFPoolInfo {
014 /**
015 * Constructor
016 *
017 * @param s data
018 */
019 public ASCIIPoolInfo(String s, ConstantPool cp) {
020 super(CONSTANT_Utf8_ASCII, s, cp);
021 }
022
023 /**
024 * Constructor reading from a stream.
025 *
026 * @param dis input stream
027 * @param cp constant pool
028 *
029 * @throws IOException
030 */
031 public ASCIIPoolInfo(DataInputStream dis, ConstantPool cp) throws IOException {
032 super(CONSTANT_Utf8_ASCII, dis, cp);
033 }
034
035 /**
036 * Return a human-readable version of this constant pool object.
037 *
038 * @return string
039 */
040 public String toStringVerbose() {
041 return "CONSTANT_Utf8_ASCII: String = " + _strValue;
042 }
043
044 /**
045 * Compare this object and another one.
046 *
047 * @param obj other object
048 *
049 * @return true if the same
050 */
051 public boolean equals(Object obj) {
052 return (obj instanceof ASCIIPoolInfo) &&
053 (((ASCIIPoolInfo)obj)._strValue.equals(_strValue));
054 }
055
056 /**
057 * Execute a visitor.
058 *
059 * @param visitor visitor
060 * @param data visitor-specific parameter
061 *
062 * @return visitor-specific return value
063 */
064 public <R, D> R execute(IPoolInfoVisitor<R, D> visitor, D data) {
065 return visitor.asciizCase(this, data);
066 }
067 }