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 Unicode data in the constant pool.
010     *
011     * @author Mathias Ricken
012     */
013    public class UnicodePoolInfo extends AUTFPoolInfo {
014        /**
015         * Constructor.
016         *
017         * @param s data
018         */
019        public UnicodePoolInfo(String s, ConstantPool cp) {
020            super(CONSTANT_Utf8_Unicode, 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 UnicodePoolInfo(DataInputStream dis, ConstantPool cp) throws IOException {
032            super(CONSTANT_Utf8_Unicode, 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_Unicode: 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 UnicodePoolInfo) &&
053                (((UnicodePoolInfo)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.unicodeCase(this, data);
066        }
067    }