Java Code Examples for java.lang.reflect.Array#getShort()

The following examples show how to use java.lang.reflect.Array#getShort() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
/**
 *
 * @param key
 * @param valueFromRegion
 * @param valueFromBB
 */
private void verifyArray(String key, Object valueFromRegion, Object valueFromBB) {
  Object regionArrayValue = null;
  Object bbArrayValue = null;
  String regionClassType = valueFromRegion.getClass().getSimpleName();
  int arrayLength = Array.getLength(valueFromRegion);
  for (int i = 0;i < arrayLength;i++) {
    if (regionClassType.contains("boolean")) {
      regionArrayValue = Array.getBoolean(valueFromRegion, i);
      bbArrayValue = Array.getBoolean(valueFromBB, i);
    } else if (regionClassType.contains("byte")) {
      regionArrayValue = Array.getByte(valueFromRegion, i);
      bbArrayValue = Array.getByte(valueFromBB, i);
    } else if (regionClassType.contains("char")) {
      regionArrayValue = Array.getChar(valueFromRegion, i);
      bbArrayValue = Array.getChar(valueFromBB, i);
    } else if (regionClassType.contains("double")) {
      regionArrayValue = Array.getDouble(valueFromRegion, i);
      bbArrayValue = Array.getDouble(valueFromBB, i);
    } else if (regionClassType.contains("float")) {
      regionArrayValue = Array.getFloat(valueFromRegion, i);
      bbArrayValue = Array.getFloat(valueFromBB, i);
    } else if (regionClassType.contains("int")) {
      regionArrayValue = Array.getInt(valueFromRegion, i);
      bbArrayValue = Array.getInt(valueFromBB, i);
    } else if (regionClassType.contains("long")) {
      regionArrayValue = Array.getLong(valueFromRegion, i);
      bbArrayValue = Array.getLong(valueFromBB, i);
    } else if (regionClassType.contains("short")) {
      regionArrayValue = Array.getShort(valueFromRegion, i);
      bbArrayValue = Array.getShort(valueFromBB, i);
    } else {
      Log.getLogWriter().info("MDP-SerialCompressionTest.verifyArray regionClassType=" + regionClassType +
                              " arrayLength=" + arrayLength);
    }

    verifyValues(key, regionArrayValue, bbArrayValue);
  }
}
 
Example 2
public void add(long value) {
    // May need to switch to a larger array type
    if ((values instanceof byte[] ||
         values instanceof short[] ||
         values instanceof int[]) &&
               value > Integer.MAX_VALUE) {
        long[] la = new long[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            la[i] = Array.getLong(values, i);
        }
        values = la;
    } else if ((values instanceof byte[] ||
                values instanceof short[]) &&
               value > Short.MAX_VALUE) {
        int[] ia = new int[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            ia[i] = Array.getInt(values, i);
        }
        values = ia;
    } else if (values instanceof byte[] &&
               value > Byte.MAX_VALUE) {
        short[] sa = new short[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            sa[i] = Array.getShort(values, i);
        }
        values = sa;
    }

    // May need to extend the array size
    if (Array.getLength(values) == size) {
        values = extendArray(values);
    }

    // Store the value
    if (values instanceof long[]) {
        ((long[])values)[size] = value;
    } else if (values instanceof int[]) {
        ((int[])values)[size] = (int)value;
    } else if (values instanceof short[]) {
        ((short[])values)[size] = (short)value;
    } else {
        ((byte[])values)[size] = (byte)value;
    }
    size++;
}
 
Example 3
Source Project: openjdk-8   File: Plotter.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void add(long value) {
    // May need to switch to a larger array type
    if ((values instanceof byte[] ||
         values instanceof short[] ||
         values instanceof int[]) &&
               value > Integer.MAX_VALUE) {
        long[] la = new long[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            la[i] = Array.getLong(values, i);
        }
        values = la;
    } else if ((values instanceof byte[] ||
                values instanceof short[]) &&
               value > Short.MAX_VALUE) {
        int[] ia = new int[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            ia[i] = Array.getInt(values, i);
        }
        values = ia;
    } else if (values instanceof byte[] &&
               value > Byte.MAX_VALUE) {
        short[] sa = new short[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            sa[i] = Array.getShort(values, i);
        }
        values = sa;
    }

    // May need to extend the array size
    if (Array.getLength(values) == size) {
        values = extendArray(values);
    }

    // Store the value
    if (values instanceof long[]) {
        ((long[])values)[size] = value;
    } else if (values instanceof int[]) {
        ((int[])values)[size] = (int)value;
    } else if (values instanceof short[]) {
        ((short[])values)[size] = (short)value;
    } else {
        ((byte[])values)[size] = (byte)value;
    }
    size++;
}
 
Example 4
public void add(long value) {
    // May need to switch to a larger array type
    if ((values instanceof byte[] ||
         values instanceof short[] ||
         values instanceof int[]) &&
               value > Integer.MAX_VALUE) {
        long[] la = new long[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            la[i] = Array.getLong(values, i);
        }
        values = la;
    } else if ((values instanceof byte[] ||
                values instanceof short[]) &&
               value > Short.MAX_VALUE) {
        int[] ia = new int[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            ia[i] = Array.getInt(values, i);
        }
        values = ia;
    } else if (values instanceof byte[] &&
               value > Byte.MAX_VALUE) {
        short[] sa = new short[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            sa[i] = Array.getShort(values, i);
        }
        values = sa;
    }

    // May need to extend the array size
    if (Array.getLength(values) == size) {
        values = extendArray(values);
    }

    // Store the value
    if (values instanceof long[]) {
        ((long[])values)[size] = value;
    } else if (values instanceof int[]) {
        ((int[])values)[size] = (int)value;
    } else if (values instanceof short[]) {
        ((short[])values)[size] = (short)value;
    } else {
        ((byte[])values)[size] = (byte)value;
    }
    size++;
}
 
Example 5
static void doit(MethodExitReturnValuesTarg xx) {
    s_show("==========  Testing static methods ================");
    s_bytef();
    s_charf();
    s_doublef();
    s_floatf();
    s_intf();
    s_longf();
    s_shortf();
    s_booleanf();

    s_stringf();
    s_classf();
    s_classLoaderf();
    s_threadf();
    s_threadGroupf();
    s_intArrayf();
    s_nullObjectf();
    s_objectf();
    s_voidf();

    s_show("==========  Testing instance methods ================");
    xx.i_bytef();
    xx.i_charf();
    xx.i_doublef();
    xx.i_floatf();
    xx.i_intf();
    xx.i_longf();
    xx.i_shortf();
    xx.i_booleanf();
    xx.i_stringf();
    xx.i_intArrayf();
    xx.i_classf();
    xx.i_classLoaderf();
    xx.i_threadf();
    xx.i_threadGroupf();
    xx.i_nullObjectf();
    xx.i_objectf();
    xx.i_voidf();

    // Prove it works for native methods too
    s_show("==========  Testing native methods ================");
    StrictMath.sin(doubleValue);
    Array.getByte(arrByte, 0);
    Array.getChar(arrChar, 0);
    Array.getDouble(arrDouble, 0);
    Array.getFloat(arrFloat, 0);
    Array.getInt(arrInt, 0);
    Array.getLong(arrLong, 0);
    Array.getShort(arrShort, 0);
    Array.getBoolean(arrBoolean, 0);
    Array.get(arrObject, 0);
    stringValue.intern();
}
 
Example 6
Source Project: jdk8u60   File: Plotter.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void add(long value) {
    // May need to switch to a larger array type
    if ((values instanceof byte[] ||
         values instanceof short[] ||
         values instanceof int[]) &&
               value > Integer.MAX_VALUE) {
        long[] la = new long[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            la[i] = Array.getLong(values, i);
        }
        values = la;
    } else if ((values instanceof byte[] ||
                values instanceof short[]) &&
               value > Short.MAX_VALUE) {
        int[] ia = new int[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            ia[i] = Array.getInt(values, i);
        }
        values = ia;
    } else if (values instanceof byte[] &&
               value > Byte.MAX_VALUE) {
        short[] sa = new short[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            sa[i] = Array.getShort(values, i);
        }
        values = sa;
    }

    // May need to extend the array size
    if (Array.getLength(values) == size) {
        values = extendArray(values);
    }

    // Store the value
    if (values instanceof long[]) {
        ((long[])values)[size] = value;
    } else if (values instanceof int[]) {
        ((int[])values)[size] = (int)value;
    } else if (values instanceof short[]) {
        ((short[])values)[size] = (short)value;
    } else {
        ((byte[])values)[size] = (byte)value;
    }
    size++;
}
 
Example 7
static void doit(MethodExitReturnValuesTarg xx) {
    s_show("==========  Testing static methods ================");
    s_bytef();
    s_charf();
    s_doublef();
    s_floatf();
    s_intf();
    s_longf();
    s_shortf();
    s_booleanf();

    s_stringf();
    s_classf();
    s_classLoaderf();
    s_threadf();
    s_threadGroupf();
    s_intArrayf();
    s_nullObjectf();
    s_objectf();
    s_voidf();

    s_show("==========  Testing instance methods ================");
    xx.i_bytef();
    xx.i_charf();
    xx.i_doublef();
    xx.i_floatf();
    xx.i_intf();
    xx.i_longf();
    xx.i_shortf();
    xx.i_booleanf();
    xx.i_stringf();
    xx.i_intArrayf();
    xx.i_classf();
    xx.i_classLoaderf();
    xx.i_threadf();
    xx.i_threadGroupf();
    xx.i_nullObjectf();
    xx.i_objectf();
    xx.i_voidf();

    // Prove it works for native methods too
    s_show("==========  Testing native methods ================");
    StrictMath.sin(doubleValue);
    Array.getByte(arrByte, 0);
    Array.getChar(arrChar, 0);
    Array.getDouble(arrDouble, 0);
    Array.getFloat(arrFloat, 0);
    Array.getInt(arrInt, 0);
    Array.getLong(arrLong, 0);
    Array.getShort(arrShort, 0);
    Array.getBoolean(arrBoolean, 0);
    Array.get(arrObject, 0);
    stringValue.intern();
}
 
Example 8
public void add(long value) {
    // May need to switch to a larger array type
    if ((values instanceof byte[] ||
         values instanceof short[] ||
         values instanceof int[]) &&
               value > Integer.MAX_VALUE) {
        long[] la = new long[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            la[i] = Array.getLong(values, i);
        }
        values = la;
    } else if ((values instanceof byte[] ||
                values instanceof short[]) &&
               value > Short.MAX_VALUE) {
        int[] ia = new int[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            ia[i] = Array.getInt(values, i);
        }
        values = ia;
    } else if (values instanceof byte[] &&
               value > Byte.MAX_VALUE) {
        short[] sa = new short[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            sa[i] = Array.getShort(values, i);
        }
        values = sa;
    }

    // May need to extend the array size
    if (Array.getLength(values) == size) {
        values = extendArray(values);
    }

    // Store the value
    if (values instanceof long[]) {
        ((long[])values)[size] = value;
    } else if (values instanceof int[]) {
        ((int[])values)[size] = (int)value;
    } else if (values instanceof short[]) {
        ((short[])values)[size] = (short)value;
    } else {
        ((byte[])values)[size] = (byte)value;
    }
    size++;
}
 
Example 9
static void doit(MethodExitReturnValuesTarg xx) {
    s_show("==========  Testing static methods ================");
    s_bytef();
    s_charf();
    s_doublef();
    s_floatf();
    s_intf();
    s_longf();
    s_shortf();
    s_booleanf();

    s_stringf();
    s_classf();
    s_classLoaderf();
    s_threadf();
    s_threadGroupf();
    s_intArrayf();
    s_nullObjectf();
    s_objectf();
    s_voidf();

    s_show("==========  Testing instance methods ================");
    xx.i_bytef();
    xx.i_charf();
    xx.i_doublef();
    xx.i_floatf();
    xx.i_intf();
    xx.i_longf();
    xx.i_shortf();
    xx.i_booleanf();
    xx.i_stringf();
    xx.i_intArrayf();
    xx.i_classf();
    xx.i_classLoaderf();
    xx.i_threadf();
    xx.i_threadGroupf();
    xx.i_nullObjectf();
    xx.i_objectf();
    xx.i_voidf();

    // Prove it works for native methods too
    s_show("==========  Testing native methods ================");
    StrictMath.sin(doubleValue);
    Array.getByte(arrByte, 0);
    Array.getChar(arrChar, 0);
    Array.getDouble(arrDouble, 0);
    Array.getFloat(arrFloat, 0);
    Array.getInt(arrInt, 0);
    Array.getLong(arrLong, 0);
    Array.getShort(arrShort, 0);
    Array.getBoolean(arrBoolean, 0);
    Array.get(arrObject, 0);
    stringValue.intern();
}
 
Example 10
public void add(long value) {
    // May need to switch to a larger array type
    if ((values instanceof byte[] ||
         values instanceof short[] ||
         values instanceof int[]) &&
               value > Integer.MAX_VALUE) {
        long[] la = new long[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            la[i] = Array.getLong(values, i);
        }
        values = la;
    } else if ((values instanceof byte[] ||
                values instanceof short[]) &&
               value > Short.MAX_VALUE) {
        int[] ia = new int[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            ia[i] = Array.getInt(values, i);
        }
        values = ia;
    } else if (values instanceof byte[] &&
               value > Byte.MAX_VALUE) {
        short[] sa = new short[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            sa[i] = Array.getShort(values, i);
        }
        values = sa;
    }

    // May need to extend the array size
    if (Array.getLength(values) == size) {
        values = extendArray(values);
    }

    // Store the value
    if (values instanceof long[]) {
        ((long[])values)[size] = value;
    } else if (values instanceof int[]) {
        ((int[])values)[size] = (int)value;
    } else if (values instanceof short[]) {
        ((short[])values)[size] = (short)value;
    } else {
        ((byte[])values)[size] = (byte)value;
    }
    size++;
}
 
Example 11
static void doit(MethodExitReturnValuesTarg xx) {
    s_show("==========  Testing static methods ================");
    s_bytef();
    s_charf();
    s_doublef();
    s_floatf();
    s_intf();
    s_longf();
    s_shortf();
    s_booleanf();

    s_stringf();
    s_classf();
    s_classLoaderf();
    s_threadf();
    s_threadGroupf();
    s_intArrayf();
    s_nullObjectf();
    s_objectf();
    s_voidf();

    s_show("==========  Testing instance methods ================");
    xx.i_bytef();
    xx.i_charf();
    xx.i_doublef();
    xx.i_floatf();
    xx.i_intf();
    xx.i_longf();
    xx.i_shortf();
    xx.i_booleanf();
    xx.i_stringf();
    xx.i_intArrayf();
    xx.i_classf();
    xx.i_classLoaderf();
    xx.i_threadf();
    xx.i_threadGroupf();
    xx.i_nullObjectf();
    xx.i_objectf();
    xx.i_voidf();

    // Prove it works for native methods too
    s_show("==========  Testing native methods ================");
    StrictMath.sin(doubleValue);
    Array.getByte(arrByte, 0);
    Array.getChar(arrChar, 0);
    Array.getDouble(arrDouble, 0);
    Array.getFloat(arrFloat, 0);
    Array.getInt(arrInt, 0);
    Array.getLong(arrLong, 0);
    Array.getShort(arrShort, 0);
    Array.getBoolean(arrBoolean, 0);
    Array.get(arrObject, 0);
    stringValue.intern();
}
 
Example 12
public static short test(int i) {
    return Array.getShort(array, i);
}
 
Example 13
Source Project: jdk8u_jdk   File: Plotter.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void add(long value) {
    // May need to switch to a larger array type
    if ((values instanceof byte[] ||
         values instanceof short[] ||
         values instanceof int[]) &&
               value > Integer.MAX_VALUE) {
        long[] la = new long[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            la[i] = Array.getLong(values, i);
        }
        values = la;
    } else if ((values instanceof byte[] ||
                values instanceof short[]) &&
               value > Short.MAX_VALUE) {
        int[] ia = new int[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            ia[i] = Array.getInt(values, i);
        }
        values = ia;
    } else if (values instanceof byte[] &&
               value > Byte.MAX_VALUE) {
        short[] sa = new short[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            sa[i] = Array.getShort(values, i);
        }
        values = sa;
    }

    // May need to extend the array size
    if (Array.getLength(values) == size) {
        values = extendArray(values);
    }

    // Store the value
    if (values instanceof long[]) {
        ((long[])values)[size] = value;
    } else if (values instanceof int[]) {
        ((int[])values)[size] = (int)value;
    } else if (values instanceof short[]) {
        ((short[])values)[size] = (short)value;
    } else {
        ((byte[])values)[size] = (byte)value;
    }
    size++;
}
 
Example 14
Source Project: visualvm   File: Plotter.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void add(long value) {
    // May need to switch to a larger array type
    if ((values instanceof byte[] ||
         values instanceof short[] ||
         values instanceof int[]) &&
               value > Integer.MAX_VALUE) {
        long[] la = new long[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            la[i] = Array.getLong(values, i);
        }
        values = la;
    } else if ((values instanceof byte[] ||
                values instanceof short[]) &&
               value > Short.MAX_VALUE) {
        int[] ia = new int[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            ia[i] = Array.getInt(values, i);
        }
        values = ia;
    } else if (values instanceof byte[] &&
               value > Byte.MAX_VALUE) {
        short[] sa = new short[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            sa[i] = Array.getShort(values, i);
        }
        values = sa;
    }

    // May need to extend the array size
    if (Array.getLength(values) == size) {
        values = extendArray(values);
    }

    // Store the value
    if (values instanceof long[]) {
        ((long[])values)[size] = value;
    } else if (values instanceof int[]) {
        ((int[])values)[size] = (int)value;
    } else if (values instanceof short[]) {
        ((short[])values)[size] = (short)value;
    } else {
        ((byte[])values)[size] = (byte)value;
    }
    size++;
}
 
Example 15
Source Project: jdk8u-jdk   File: Plotter.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void add(long value) {
    // May need to switch to a larger array type
    if ((values instanceof byte[] ||
         values instanceof short[] ||
         values instanceof int[]) &&
               value > Integer.MAX_VALUE) {
        long[] la = new long[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            la[i] = Array.getLong(values, i);
        }
        values = la;
    } else if ((values instanceof byte[] ||
                values instanceof short[]) &&
               value > Short.MAX_VALUE) {
        int[] ia = new int[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            ia[i] = Array.getInt(values, i);
        }
        values = ia;
    } else if (values instanceof byte[] &&
               value > Byte.MAX_VALUE) {
        short[] sa = new short[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            sa[i] = Array.getShort(values, i);
        }
        values = sa;
    }

    // May need to extend the array size
    if (Array.getLength(values) == size) {
        values = extendArray(values);
    }

    // Store the value
    if (values instanceof long[]) {
        ((long[])values)[size] = value;
    } else if (values instanceof int[]) {
        ((int[])values)[size] = (int)value;
    } else if (values instanceof short[]) {
        ((short[])values)[size] = (short)value;
    } else {
        ((byte[])values)[size] = (byte)value;
    }
    size++;
}
 
Example 16
static void doit(MethodExitReturnValuesTarg xx) {
    s_show("==========  Testing static methods ================");
    s_bytef();
    s_charf();
    s_doublef();
    s_floatf();
    s_intf();
    s_longf();
    s_shortf();
    s_booleanf();

    s_stringf();
    s_classf();
    s_classLoaderf();
    s_threadf();
    s_threadGroupf();
    s_intArrayf();
    s_nullObjectf();
    s_objectf();
    s_voidf();

    s_show("==========  Testing instance methods ================");
    xx.i_bytef();
    xx.i_charf();
    xx.i_doublef();
    xx.i_floatf();
    xx.i_intf();
    xx.i_longf();
    xx.i_shortf();
    xx.i_booleanf();
    xx.i_stringf();
    xx.i_intArrayf();
    xx.i_classf();
    xx.i_classLoaderf();
    xx.i_threadf();
    xx.i_threadGroupf();
    xx.i_nullObjectf();
    xx.i_objectf();
    xx.i_voidf();

    // Prove it works for native methods too
    s_show("==========  Testing native methods ================");
    StrictMath.sin(doubleValue);
    Array.getByte(arrByte, 0);
    Array.getChar(arrChar, 0);
    Array.getDouble(arrDouble, 0);
    Array.getFloat(arrFloat, 0);
    Array.getInt(arrInt, 0);
    Array.getLong(arrLong, 0);
    Array.getShort(arrShort, 0);
    Array.getBoolean(arrBoolean, 0);
    Array.get(arrObject, 0);
    stringValue.intern();
}
 
Example 17
Source Project: hottub   File: Plotter.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void add(long value) {
    // May need to switch to a larger array type
    if ((values instanceof byte[] ||
         values instanceof short[] ||
         values instanceof int[]) &&
               value > Integer.MAX_VALUE) {
        long[] la = new long[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            la[i] = Array.getLong(values, i);
        }
        values = la;
    } else if ((values instanceof byte[] ||
                values instanceof short[]) &&
               value > Short.MAX_VALUE) {
        int[] ia = new int[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            ia[i] = Array.getInt(values, i);
        }
        values = ia;
    } else if (values instanceof byte[] &&
               value > Byte.MAX_VALUE) {
        short[] sa = new short[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            sa[i] = Array.getShort(values, i);
        }
        values = sa;
    }

    // May need to extend the array size
    if (Array.getLength(values) == size) {
        values = extendArray(values);
    }

    // Store the value
    if (values instanceof long[]) {
        ((long[])values)[size] = value;
    } else if (values instanceof int[]) {
        ((int[])values)[size] = (int)value;
    } else if (values instanceof short[]) {
        ((short[])values)[size] = (short)value;
    } else {
        ((byte[])values)[size] = (byte)value;
    }
    size++;
}
 
Example 18
static void doit(MethodExitReturnValuesTarg xx) {
    s_show("==========  Testing static methods ================");
    s_bytef();
    s_charf();
    s_doublef();
    s_floatf();
    s_intf();
    s_longf();
    s_shortf();
    s_booleanf();

    s_stringf();
    s_classf();
    s_classLoaderf();
    s_threadf();
    s_threadGroupf();
    s_intArrayf();
    s_nullObjectf();
    s_objectf();
    s_voidf();

    s_show("==========  Testing instance methods ================");
    xx.i_bytef();
    xx.i_charf();
    xx.i_doublef();
    xx.i_floatf();
    xx.i_intf();
    xx.i_longf();
    xx.i_shortf();
    xx.i_booleanf();
    xx.i_stringf();
    xx.i_intArrayf();
    xx.i_classf();
    xx.i_classLoaderf();
    xx.i_threadf();
    xx.i_threadGroupf();
    xx.i_nullObjectf();
    xx.i_objectf();
    xx.i_voidf();

    // Prove it works for native methods too
    s_show("==========  Testing native methods ================");
    StrictMath.sin(doubleValue);
    Array.getByte(arrByte, 0);
    Array.getChar(arrChar, 0);
    Array.getDouble(arrDouble, 0);
    Array.getFloat(arrFloat, 0);
    Array.getInt(arrInt, 0);
    Array.getLong(arrLong, 0);
    Array.getShort(arrShort, 0);
    Array.getBoolean(arrBoolean, 0);
    Array.get(arrObject, 0);
    stringValue.intern();
}
 
Example 19
public void add(long value) {
    // May need to switch to a larger array type
    if ((values instanceof byte[] ||
         values instanceof short[] ||
         values instanceof int[]) &&
               value > Integer.MAX_VALUE) {
        long[] la = new long[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            la[i] = Array.getLong(values, i);
        }
        values = la;
    } else if ((values instanceof byte[] ||
                values instanceof short[]) &&
               value > Short.MAX_VALUE) {
        int[] ia = new int[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            ia[i] = Array.getInt(values, i);
        }
        values = ia;
    } else if (values instanceof byte[] &&
               value > Byte.MAX_VALUE) {
        short[] sa = new short[Array.getLength(values)];
        for (int i = 0; i < size; i++) {
            sa[i] = Array.getShort(values, i);
        }
        values = sa;
    }

    // May need to extend the array size
    if (Array.getLength(values) == size) {
        values = extendArray(values);
    }

    // Store the value
    if (values instanceof long[]) {
        ((long[])values)[size] = value;
    } else if (values instanceof int[]) {
        ((int[])values)[size] = (int)value;
    } else if (values instanceof short[]) {
        ((short[])values)[size] = (short)value;
    } else {
        ((byte[])values)[size] = (byte)value;
    }
    size++;
}
 
Example 20
static void doit(MethodExitReturnValuesTarg xx) {
    s_show("==========  Testing static methods ================");
    s_bytef();
    s_charf();
    s_doublef();
    s_floatf();
    s_intf();
    s_longf();
    s_shortf();
    s_booleanf();

    s_stringf();
    s_classf();
    s_classLoaderf();
    s_threadf();
    s_threadGroupf();
    s_intArrayf();
    s_nullObjectf();
    s_objectf();
    s_voidf();

    s_show("==========  Testing instance methods ================");
    xx.i_bytef();
    xx.i_charf();
    xx.i_doublef();
    xx.i_floatf();
    xx.i_intf();
    xx.i_longf();
    xx.i_shortf();
    xx.i_booleanf();
    xx.i_stringf();
    xx.i_intArrayf();
    xx.i_classf();
    xx.i_classLoaderf();
    xx.i_threadf();
    xx.i_threadGroupf();
    xx.i_nullObjectf();
    xx.i_objectf();
    xx.i_voidf();

    // Prove it works for native methods too
    s_show("==========  Testing native methods ================");
    StrictMath.sin(doubleValue);
    Array.getByte(arrByte, 0);
    Array.getChar(arrChar, 0);
    Array.getDouble(arrDouble, 0);
    Array.getFloat(arrFloat, 0);
    Array.getInt(arrInt, 0);
    Array.getLong(arrLong, 0);
    Array.getShort(arrShort, 0);
    Array.getBoolean(arrBoolean, 0);
    Array.get(arrObject, 0);
    stringValue.intern();
}