當前位置: 首頁>>代碼示例>>Java>>正文


Java ConstantPool類代碼示例

本文整理匯總了Java中com.sun.squawk.translator.ci.ConstantPool的典型用法代碼示例。如果您正苦於以下問題:Java ConstantPool類的具體用法?Java ConstantPool怎麽用?Java ConstantPool使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ConstantPool類屬於com.sun.squawk.translator.ci包,在下文中一共展示了ConstantPool類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doConstant

import com.sun.squawk.translator.ci.ConstantPool; //導入依賴的package包/類
/**
     * {@inheritDoc}
     */
    public void doConstant(Constant instruction) {
        int tag = instruction.getTag();
        int opcode;
        Object value = instruction.getValue();
        switch (tag) {
/*if[FLOATS]*/
            case ConstantPool.CONSTANT_Double:  opcode = OPC.CONST_DOUBLE;    break;
            case ConstantPool.CONSTANT_Float:   opcode = OPC.CONST_FLOAT;     break;
/*end[FLOATS]*/
            case ConstantPool.CONSTANT_Long:    opcode = OPC.CONST_LONG;      break;
            case ConstantPool.CONSTANT_Integer: opcode = OPC.CONST_INT;       break;
            default: {
                if (value == null) {
                    opcode = OPC.CONST_NULL;
                    value = "";
                } else {
                    opcode = OPC.OBJECT;
                    value  = "\"" + value + "\"";
                }
                break;
            }
        }
        out.append(Mnemonics.getMnemonic(opcode) + " " + value);
    }
 
開發者ID:tomatsu,項目名稱:squawk,代碼行數:28,代碼來源:InstructionTracer.java

示例2: doConstant

import com.sun.squawk.translator.ci.ConstantPool; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
public void doConstant(Constant instruction) {
    int tag = instruction.getTag();
    int opcode;
    Object value = instruction.getValue();
    switch (tag) {

        case ConstantPool.CONSTANT_Double:  opcode = OPC.CONST_DOUBLE;    break;
        case ConstantPool.CONSTANT_Float:   opcode = OPC.CONST_FLOAT;     break;

        case ConstantPool.CONSTANT_Long:    opcode = OPC.CONST_LONG;      break;
        case ConstantPool.CONSTANT_Integer: opcode = OPC.CONST_INT;       break;
        default: {
            if (value == null) {
                opcode = OPC.CONST_NULL;
                value = "";
            } else {
                opcode = OPC.OBJECT;
                value  = "\"" + value + "\"";
            }
            break;
        }
    }
    out.append(Mnemonics.getMnemonic(opcode) + " " + value);
}
 
開發者ID:sics-sse,項目名稱:moped,代碼行數:28,代碼來源:InstructionTracer.java

示例3: doConstant

import com.sun.squawk.translator.ci.ConstantPool; //導入依賴的package包/類
/**
     * {@inheritDoc}
     */
    public void doConstant(Constant instruction) {
        Object value = instruction.getValue();
        switch (instruction.getTag()) {
/*if[FLOATS]*/
            case ConstantPool.CONSTANT_Double: {
                emitConstantDouble(((Double)value).doubleValue());
                break;
            }
            case ConstantPool.CONSTANT_Float: {
                emitConstantFloat(((Float)value).floatValue());
                break;
            }
/*end[FLOATS]*/
            case ConstantPool.CONSTANT_Long: {
                emitConstantLong(((Long)value).longValue());
                break;
            }
            case ConstantPool.CONSTANT_Integer: {
                emitConstantInt(((Integer)value).intValue());
                break;
            }
            default: {
                emitConstantObject(value);
                break;
            }
        }
    }
 
開發者ID:tomatsu,項目名稱:squawk,代碼行數:31,代碼來源:InstructionEmitter.java

示例4: doConstant

import com.sun.squawk.translator.ci.ConstantPool; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
public void doConstant(Constant instruction) {
    Object value = instruction.getValue();
    switch (instruction.getTag()) {

        case ConstantPool.CONSTANT_Double: {
            emitConstantDouble(((Double)value).doubleValue());
            break;
        }
        case ConstantPool.CONSTANT_Float: {
            emitConstantFloat(((Float)value).floatValue());
            break;
        }

        case ConstantPool.CONSTANT_Long: {
            emitConstantLong(((Long)value).longValue());
            break;
        }
        case ConstantPool.CONSTANT_Integer: {
            emitConstantInt(((Integer)value).intValue());
            break;
        }
        default: {
            emitConstantObject(value);
            break;
        }
    }
}
 
開發者ID:sics-sse,項目名稱:moped,代碼行數:31,代碼來源:InstructionEmitter.java

示例5: ConstantObject

import com.sun.squawk.translator.ci.ConstantPool; //導入依賴的package包/類
/**
 * Creates a <code>ConstantObject</code> instance representing the
 * loading of a constant object value to the operand stack.
 *
 * @param type   the type of the value
 * @param value  the object value
 */
public ConstantObject(Klass type, Object value) {
    super(type, ConstantPool.CONSTANT_Object, value);
}
 
開發者ID:tomatsu,項目名稱:squawk,代碼行數:11,代碼來源:ConstantObject.java

示例6: ConstantFloat

import com.sun.squawk.translator.ci.ConstantPool; //導入依賴的package包/類
/**
 * Creates a <code>ConstantFloat</code> instance representing the
 * loading of a constant float value to the operand stack.
 *
 * @param value  the float value (wrapped in a {@link Float} object)
 */
public ConstantFloat(Float value) {
    super(Klass.FLOAT, ConstantPool.CONSTANT_Float, value);
}
 
開發者ID:tomatsu,項目名稱:squawk,代碼行數:10,代碼來源:ConstantFloat.java

示例7: ConstantLong

import com.sun.squawk.translator.ci.ConstantPool; //導入依賴的package包/類
/**
 * Creates a <code>ConstantLong</code> instance representing the
 * loading of a constant long value to the operand stack.
 *
 * @param value  the long value (wrapped in a {@link Long} object)
 */
public ConstantLong(Long value) {
    super(Klass.LONG, ConstantPool.CONSTANT_Long, value);
}
 
開發者ID:tomatsu,項目名稱:squawk,代碼行數:10,代碼來源:ConstantLong.java

示例8: ConstantInt

import com.sun.squawk.translator.ci.ConstantPool; //導入依賴的package包/類
/**
 * Creates a <code>ConstantInt</code> instance representing the
 * loading of a constant integer value to the operand stack.
 *
 * @param value  the integer value (wrapped in a {@link Integer} object)
 */
public ConstantInt(Integer value) {
    super(Klass.INT, ConstantPool.CONSTANT_Integer, value);
}
 
開發者ID:tomatsu,項目名稱:squawk,代碼行數:10,代碼來源:ConstantInt.java

示例9: ConstantDouble

import com.sun.squawk.translator.ci.ConstantPool; //導入依賴的package包/類
/**
 * Creates a <code>ConstantDouble</code> instance representing the
 * loading of a constant double value to the operand stack.
 *
 * @param value  the double value (wrapped in a {@link Double} object)
 */
public ConstantDouble(Double value) {
    super(Klass.DOUBLE, ConstantPool.CONSTANT_Double, value);
}
 
開發者ID:tomatsu,項目名稱:squawk,代碼行數:10,代碼來源:ConstantDouble.java


注:本文中的com.sun.squawk.translator.ci.ConstantPool類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。