⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 constantpoolinfo.java

📁 JPC: x86 PC Hardware Emulator. 牛津大学开发的一个纯JAVA的x86系统结构硬件模拟器。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            return bytes;
        }

        public void write(DataOutputStream out) throws IOException
        {
            out.writeByte(INTEGER);
            out.writeInt(bytes);
        }

	public int hashCode()
	{
	    return hashCode;
	}

        public boolean equals(Object obj)
        {
            if (obj == this)
                return true;

            if (!(obj instanceof IntegerInfo))
                return false;

            return getBytes() == ((IntegerInfo)obj).getBytes();
        }

        public String toString()
        {
            return "CONSTANT_Integer_info : value=" + getBytes();
        }
    }

    public static class FloatInfo extends ConstantPoolInfo
    {
        private final float bytes;
	private final int hashCode;

        FloatInfo(DataInputStream in) throws IOException
        {
            bytes = in.readFloat();
	    hashCode = (this.getClass().hashCode() * 31) ^ (Float.floatToRawIntBits(bytes) * 37);
        }

        FloatInfo(float val)
        {
            bytes = val;
	    hashCode = (this.getClass().hashCode() * 31) ^ (Float.floatToRawIntBits(bytes) * 37);
        }

        public int getTag()
        {
            return FLOAT;
        }

        public float getBytes()
        {
            return bytes;
        }

        public void write(DataOutputStream out) throws IOException
        {
            out.writeByte(FLOAT);
            out.writeFloat(bytes);
        }

	public int hashCode()
	{
	    return hashCode;
	}

        public boolean equals(Object obj)
        {
            if (obj == this)
                return true;

            if (!(obj instanceof FloatInfo))
                return false;

            return getBytes() == ((FloatInfo)obj).getBytes();
        }

        public String toString()
        {
            return "CONSTANT_Float_info : value=" + getBytes();
        }
    }

    public static class LongInfo extends ConstantPoolInfo
    {
        private final long bytes;
	private final int hashCode;

        LongInfo(DataInputStream in) throws IOException
        {
            bytes = in.readLong();
	    hashCode = (this.getClass().hashCode() * 31) ^ (((int)bytes) * 37) ^ (((int)(bytes >>> 32)) * 41);
        }

        LongInfo(long val)
        {
            bytes = val;
	    hashCode = (this.getClass().hashCode() * 31) ^ (((int)bytes) * 37) ^ (((int)(bytes >>> 32)) * 41);
        }

        public int getTag()
        {
            return LONG;
        }

        public long getBytes()
        {
            return bytes;
        }

        public void write(DataOutputStream out) throws IOException
        {
            out.writeByte(LONG);
            out.writeLong(bytes);
        }

	public int hashCode()
	{
	    return hashCode;
	}

        public boolean equals(Object obj)
        {
            if (obj == this)
                return true;

            if (!(obj instanceof LongInfo))
                return false;

            return getBytes() == ((LongInfo)obj).getBytes();
        }

        public String toString()
        {
            return "CONSTANT_Long_info : value=" + getBytes();
        }
    }

    public static class DoubleInfo extends ConstantPoolInfo
    {
        private final double bytes;
	private final int hashCode;

        DoubleInfo(DataInputStream in) throws IOException
        {
            bytes = in.readDouble();
	    long longBytes = Double.doubleToRawLongBits(bytes);
	    hashCode = (this.getClass().hashCode() * 31) ^ (((int)longBytes) * 37) ^ (((int)(longBytes >>> 32)) * 41);
        }

        DoubleInfo(double val)
        {
            bytes = val;
	    long longBytes = Double.doubleToRawLongBits(bytes);
	    hashCode = (this.getClass().hashCode() * 31) ^ (((int)longBytes) * 37) ^ (((int)(longBytes >>> 32)) * 41);
        }

        public int getTag()
        {
            return DOUBLE;
        }

        public double getBytes()
        {
            return bytes;
        }

        public void write(DataOutputStream out) throws IOException
        {
            out.writeByte(DOUBLE);
            out.writeDouble(bytes);
        }

	public int hashCode()
	{
	    return hashCode;
	}

        public boolean equals(Object obj)
        {
            if (obj == this)
                return true;

            if (!(obj instanceof DoubleInfo))
                return false;

            return getBytes() == ((DoubleInfo)obj).getBytes();
        }

        public String toString()
        {
            return "CONSTANT_Double_info : value=" + getBytes();
        }
    }

    public static class NameAndTypeInfo extends ConstantPoolInfo
    {
        private final int nameIndex;
        private final int descriptorIndex;
	private final int hashCode;

        NameAndTypeInfo(DataInputStream in) throws IOException
        {
            nameIndex = in.readUnsignedShort();
            descriptorIndex = in.readUnsignedShort();
	    hashCode = (this.getClass().hashCode() * 31) ^ (nameIndex * 37) ^ (descriptorIndex * 41);
        }

        NameAndTypeInfo(int nameIndex, int descriptorIndex)
        {
            this.nameIndex = nameIndex;
            this.descriptorIndex = descriptorIndex;
	    hashCode = (this.getClass().hashCode() * 31) ^ (nameIndex * 37) ^ (descriptorIndex * 41);
        }

        public int getTag()
        {
            return NAMEANDTYPE;
        }

        public int getNameIndex()
        {
            return nameIndex;
        }

        public int getDescriptorIndex()
        {
            return descriptorIndex;
        }

        public void write(DataOutputStream out) throws IOException
        {
            out.writeByte(NAMEANDTYPE);
            out.writeShort(nameIndex);
            out.writeShort(descriptorIndex);
        }

	public int hashCode()
	{
	    return hashCode;
	}

        public boolean equals(Object obj)
        {
            if (obj == this)
                return true;

            if (!(obj instanceof NameAndTypeInfo))
                return false;

            return (getNameIndex() == ((NameAndTypeInfo)obj).getNameIndex())
                && (getDescriptorIndex() == ((NameAndTypeInfo)obj).getDescriptorIndex());
        }

        public String toString()
        {
            return "CONSTANT_NameAndType_info : descriptor=" + getDescriptorIndex() + " : name=" + getNameIndex();
        }
    }

    public static class Utf8Info extends ConstantPoolInfo
    {
        private final String bytes;
	private final int hashCode;

        Utf8Info(DataInputStream in) throws IOException
        {
            bytes = in.readUTF();
	    hashCode = (this.getClass().hashCode() * 31) ^ (bytes.hashCode() * 37);
        }

        Utf8Info(String val)
        {
            bytes = val;
	    hashCode = (this.getClass().hashCode() * 31) ^ (bytes.hashCode() * 37);
        }

        public int getTag()
        {
            return UTF8;
        }

        public String getBytes()
        {
            return bytes;
        }

        public void write(DataOutputStream out) throws IOException
        {
            out.writeByte(UTF8);
            out.writeUTF(bytes);
        }

	public int hashCode()
	{
	    return hashCode;
	}

        public boolean equals(Object obj)
        {
            if (obj == this)
                return true;

            if (!(obj instanceof Utf8Info))
                return false;

            return getBytes().equals(((Utf8Info)obj).getBytes());
        }

        public String toString()
        {
            return "CONSTANT_Utf8_info : value=" + getBytes();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -