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

The following examples show how to use java.lang.reflect.Array#getDouble() . 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: cfFixedArrayData.java    From openbd-core with GNU General Public License v3.0 6 votes vote down vote up
public double getMin() throws dataNotSupportedException {
  int arrayLen = Array.getLength( array );
  
  double min;
  try{
    min = arrayLen > 0 ? Array.getDouble( array, 0 ) : 0.0;
    for ( int i = 1; i < arrayLen; i++ ){
      double nextVal = Array.getDouble( array, i );
      if ( nextVal < min ){
        min = nextVal;
      }
    }
  }catch( IllegalArgumentException iae ){
    throw new dataNotSupportedException( "Found non-numeric value in array." );
  }

  return min; 
}
 
Example 2
Source File: cfFixedArrayData.java    From openbd-core with GNU General Public License v3.0 6 votes vote down vote up
public double getMax() throws dataNotSupportedException {
  int arrayLen = Array.getLength( array );
  double max;
  try{
    max = arrayLen > 0 ? Array.getDouble( array, 0 ) : 0.0;
    for ( int i = 1; i < arrayLen; i++ ){
      double nextVal = Array.getDouble( array, i );
      if ( nextVal > max ){
        max = nextVal;
      }
    }
  }catch( IllegalArgumentException iae ){
    throw new dataNotSupportedException( "Found non-numeric value in array." );
  }
  return max; 
}
 
Example 3
Source File: SerialCompressionTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @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 4
Source File: Formatter.java    From rice with Educational Community License v2.0 5 votes vote down vote up
public static Object toObject(Object value) {
    if (!value.getClass().isArray())
        return value;

    Class type = value.getClass().getComponentType();
    if (Array.getLength(value) == 0)
        return null;
    if (!type.isPrimitive())
        return Array.get(value, 0);
    if (boolean.class.isAssignableFrom(type))
        return Array.getBoolean(value, 0);
    if (char.class.isAssignableFrom(type))
        return new Character(Array.getChar(value, 0));
    if (byte.class.isAssignableFrom(type))
        return new Byte(Array.getByte(value, 0));
    if (int.class.isAssignableFrom(type))
        return new Integer(Array.getInt(value, 0));
    if (long.class.isAssignableFrom(type))
        return new Long(Array.getLong(value, 0));
    if (short.class.isAssignableFrom(type))
        return new Short(Array.getShort(value, 0));
    if (double.class.isAssignableFrom(type))
        return new Double(Array.getDouble(value, 0));
    if (float.class.isAssignableFrom(type))
        return new Float(Array.getFloat(value, 0));

    return null;
}
 
Example 5
Source File: cfFixedArrayData.java    From openbd-core with GNU General Public License v3.0 5 votes vote down vote up
public double getSum() throws dataNotSupportedException {
  int arrayLen = Array.getLength( array );
  double sum = 0.0;
  
  try{
    for ( int i = 0; i < arrayLen; i++ ){
      sum += Array.getDouble( array, i );
    }
  }catch( IllegalArgumentException iae ){
    throw new dataNotSupportedException( "Found non-numeric value in array." );
  }
  return sum; 
}
 
Example 6
Source File: SerialCompressionTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @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 7
Source File: MethodExitReturnValuesTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
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
Source File: MethodExitReturnValuesTest.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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 9
Source File: MethodExitReturnValuesTest.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
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
Source File: MethodExitReturnValuesTest.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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 11
Source File: MethodExitReturnValuesTest.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
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
Source File: MethodExitReturnValuesTest.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
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 13
Source File: Array_getDouble01.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static double test(int i) {
    return Array.getDouble(array, i);
}
 
Example 14
Source File: MethodExitReturnValuesTest.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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 15
Source File: MethodExitReturnValuesTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
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 16
Source File: MethodExitReturnValuesTest.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
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 File: MethodExitReturnValuesTest.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
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 18
Source File: MethodExitReturnValuesTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
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
Source File: RangeSet.java    From sis with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a {@linkplain Range#getMaxValue() range maximum value} as a {@code double}.
 * The {@code index} can be any value from 0 inclusive to the set's {@link #size size}
 * exclusive. The returned values always increase with {@code index}.
 * Widening conversions are performed as needed.
 *
 * @param  index  the range index, from 0 inclusive to {@link #size size} exclusive.
 * @return the maximum value for the range at the specified index, exclusive.
 * @throws IndexOutOfBoundsException if {@code index} is out of bounds.
 * @throws ClassCastException if range elements are not convertible to numbers.
 *
 * @see org.apache.sis.measure.NumberRange#getMaxDouble()
 */
public double getMaxDouble(int index) throws IndexOutOfBoundsException, ClassCastException {
    if ((index *= 2) >= length) {
        throw new IndexOutOfBoundsException();
    }
    return Array.getDouble(array, index + 1);
}
 
Example 20
Source File: RangeSet.java    From sis with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a {@linkplain Range#getMinValue() range minimum value} as a {@code double}.
 * The {@code index} can be any value from 0 inclusive to the set {@link #size() size}
 * exclusive. The returned values always increase with {@code index}.
 * Widening conversions are performed as needed.
 *
 * @param  index  the range index, from 0 inclusive to {@link #size() size} exclusive.
 * @return the minimum value for the range at the specified index, inclusive.
 * @throws IndexOutOfBoundsException if {@code index} is out of bounds.
 * @throws ClassCastException if range elements are not convertible to numbers.
 *
 * @see org.apache.sis.measure.NumberRange#getMinDouble()
 */
public double getMinDouble(int index) throws IndexOutOfBoundsException, ClassCastException {
    if ((index *= 2) >= length) {
        throw new IndexOutOfBoundsException();
    }
    return Array.getDouble(array, index);
}