Java Code Examples for proguard.classfile.ClassConstants#TYPE_FLOAT

The following examples show how to use proguard.classfile.ClassConstants#TYPE_FLOAT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InitialValueFactory.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an initial value (0, 0L, 0.0f, 0.0, null) of the given type.
 */
public Value createValue(String type)
{
    switch (type.charAt(0))
    {
        case ClassConstants.TYPE_BOOLEAN:
        case ClassConstants.TYPE_BYTE:
        case ClassConstants.TYPE_CHAR:
        case ClassConstants.TYPE_SHORT:
        case ClassConstants.TYPE_INT:
            return valueFactory.createIntegerValue(0);

        case ClassConstants.TYPE_LONG:
            return valueFactory.createLongValue(0L);

        case ClassConstants.TYPE_FLOAT:
            return valueFactory.createFloatValue(0.0f);

        case ClassConstants.TYPE_DOUBLE:
            return valueFactory.createDoubleValue(0.0);

        case ClassConstants.TYPE_CLASS_START:
        case ClassConstants.TYPE_ARRAY:
            return valueFactory.createReferenceValueNull();

        default:
            throw new IllegalArgumentException("Invalid type ["+type+"]");
    }
}
 
Example 2
Source File: InitialValueFactory.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an initial value (0, 0L, 0.0f, 0.0, null) of the given type.
 */
public Value createValue(String type)
{
    switch (type.charAt(0))
    {
        case ClassConstants.TYPE_BOOLEAN:
        case ClassConstants.TYPE_BYTE:
        case ClassConstants.TYPE_CHAR:
        case ClassConstants.TYPE_SHORT:
        case ClassConstants.TYPE_INT:
            return valueFactory.createIntegerValue(0);

        case ClassConstants.TYPE_LONG:
            return valueFactory.createLongValue(0L);

        case ClassConstants.TYPE_FLOAT:
            return valueFactory.createFloatValue(0.0f);

        case ClassConstants.TYPE_DOUBLE:
            return valueFactory.createDoubleValue(0.0);

        case ClassConstants.TYPE_CLASS_START:
        case ClassConstants.TYPE_ARRAY:
            return valueFactory.createReferenceValueNull();

        default:
            throw new IllegalArgumentException("Invalid type ["+type+"]");
    }
}
 
Example 3
Source File: InstructionUtil.java    From proguard with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the internal type corresponding to the given 'newarray' type.
 * @param arrayType <code>InstructionConstants.ARRAY_T_BOOLEAN</code>,
 *                  <code>InstructionConstants.ARRAY_T_BYTE</code>,
 *                  <code>InstructionConstants.ARRAY_T_CHAR</code>,
 *                  <code>InstructionConstants.ARRAY_T_SHORT</code>,
 *                  <code>InstructionConstants.ARRAY_T_INT</code>,
 *                  <code>InstructionConstants.ARRAY_T_LONG</code>,
 *                  <code>InstructionConstants.ARRAY_T_FLOAT</code>, or
 *                  <code>InstructionConstants.ARRAY_T_DOUBLE</code>.
 * @return <code>ClassConstants.TYPE_BOOLEAN</code>,
 *         <code>ClassConstants.TYPE_BYTE</code>,
 *         <code>ClassConstants.TYPE_CHAR</code>,
 *         <code>ClassConstants.TYPE_SHORT</code>,
 *         <code>ClassConstants.TYPE_INT</code>,
 *         <code>ClassConstants.TYPE_LONG</code>,
 *         <code>ClassConstants.TYPE_FLOAT</code>, or
 *         <code>ClassConstants.TYPE_DOUBLE</code>.
 */
public static char internalTypeFromArrayType(byte arrayType)
{
    switch (arrayType)
    {
        case InstructionConstants.ARRAY_T_BOOLEAN: return ClassConstants.TYPE_BOOLEAN;
        case InstructionConstants.ARRAY_T_CHAR:    return ClassConstants.TYPE_CHAR;
        case InstructionConstants.ARRAY_T_FLOAT:   return ClassConstants.TYPE_FLOAT;
        case InstructionConstants.ARRAY_T_DOUBLE:  return ClassConstants.TYPE_DOUBLE;
        case InstructionConstants.ARRAY_T_BYTE:    return ClassConstants.TYPE_BYTE;
        case InstructionConstants.ARRAY_T_SHORT:   return ClassConstants.TYPE_SHORT;
        case InstructionConstants.ARRAY_T_INT:     return ClassConstants.TYPE_INT;
        case InstructionConstants.ARRAY_T_LONG:    return ClassConstants.TYPE_LONG;
        default: throw new IllegalArgumentException("Unknown array type ["+arrayType+"]");
    }
}
 
Example 4
Source File: InstructionUtil.java    From bazel with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the internal type corresponding to the given 'newarray' type.
 * @param arrayType <code>InstructionConstants.ARRAY_T_BOOLEAN</code>,
 *                  <code>InstructionConstants.ARRAY_T_BYTE</code>,
 *                  <code>InstructionConstants.ARRAY_T_CHAR</code>,
 *                  <code>InstructionConstants.ARRAY_T_SHORT</code>,
 *                  <code>InstructionConstants.ARRAY_T_INT</code>,
 *                  <code>InstructionConstants.ARRAY_T_LONG</code>,
 *                  <code>InstructionConstants.ARRAY_T_FLOAT</code>, or
 *                  <code>InstructionConstants.ARRAY_T_DOUBLE</code>.
 * @return <code>ClassConstants.TYPE_BOOLEAN</code>,
 *         <code>ClassConstants.TYPE_BYTE</code>,
 *         <code>ClassConstants.TYPE_CHAR</code>,
 *         <code>ClassConstants.TYPE_SHORT</code>,
 *         <code>ClassConstants.TYPE_INT</code>,
 *         <code>ClassConstants.TYPE_LONG</code>,
 *         <code>ClassConstants.TYPE_FLOAT</code>, or
 *         <code>ClassConstants.TYPE_DOUBLE</code>.
 */
public static char internalTypeFromArrayType(byte arrayType)
{
    switch (arrayType)
    {
        case InstructionConstants.ARRAY_T_BOOLEAN: return ClassConstants.TYPE_BOOLEAN;
        case InstructionConstants.ARRAY_T_CHAR:    return ClassConstants.TYPE_CHAR;
        case InstructionConstants.ARRAY_T_FLOAT:   return ClassConstants.TYPE_FLOAT;
        case InstructionConstants.ARRAY_T_DOUBLE:  return ClassConstants.TYPE_DOUBLE;
        case InstructionConstants.ARRAY_T_BYTE:    return ClassConstants.TYPE_BYTE;
        case InstructionConstants.ARRAY_T_SHORT:   return ClassConstants.TYPE_SHORT;
        case InstructionConstants.ARRAY_T_INT:     return ClassConstants.TYPE_INT;
        case InstructionConstants.ARRAY_T_LONG:    return ClassConstants.TYPE_LONG;
        default: throw new IllegalArgumentException("Unknown array type ["+arrayType+"]");
    }
}