Rule Execution Server API

ilog.rules.factory
Class IlrArray

java.lang.Object
  extended by ilog.rules.factory.IlrArray

public class IlrArray
extends Object

This class contains static methods for invoking the XOM API on array classes. This class manage the native Java arrays and the dynamic arrays.

Since:
4.0

Method Summary
static Object get(Object array, int index)
          Gets an element of an array.
static boolean getBoolean(Object array, int index)
          Gets an element of an array as a boolean value.
static byte getByte(Object array, int index)
          Gets an element of an array as a byte value.
static char getChar(Object array, int index)
          Gets an element of an array as a char value.
static double getDouble(Object array, int index)
          Gets an element of an array as a double value.
static float getFloat(Object array, int index)
          Gets an element of an array as a float value.
static int getInt(Object array, int index)
          Gets an element of an array as an int value.
static int getLength(Object array)
          Gets the length of an array.
static long getLong(Object array, int index)
          Gets an element of an array as a long value.
static short getShort(Object array, int index)
          Gets an element of an array as a short value.
static Object newInstance(IlrType componentType, int length)
          Deprecated. As of JRules 6.5, use IlrReflect.newArrayInstance(ilog.rules.bom.IlrType, int) instead.
static Object newInstance(IlrType componentType, int[] dimensions)
          Deprecated. As of JRules 6.5, use IlrReflect.newArrayInstance(ilog.rules.bom.IlrType, int[]) instead.
static void set(Object array, int index, Object value)
          Sets an element of an array to a value.
static void setBoolean(Object array, int index, boolean value)
          Sets an element of an array to a boolean value.
static void setByte(Object array, int index, byte b)
          Sets an element of an array to a byte value.
static void setChar(Object array, int index, char c)
          Sets an element of an array to a char value.
static void setDouble(Object array, int index, double d)
          Sets an element of an array to a double value.
static void setFloat(Object array, int index, float f)
          Sets an element of an array to a float value.
static void setInt(Object array, int index, int i)
          Sets an element of an array to an int value.
static void setLong(Object array, int index, long l)
          Sets an element of an array to a long value.
static void setShort(Object array, int index, short s)
          Sets an element of an array to a short value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInstance

public static Object newInstance(IlrType componentType,
                                 int length)
                          throws NegativeArraySizeException
Deprecated. As of JRules 6.5, use IlrReflect.newArrayInstance(ilog.rules.bom.IlrType, int) instead.

Creates an array of type componentType and of length length.

Throws:
NegativeArraySizeException - If the passed length is negative.
Parameters:
componentType - The component type.
length - The array length.
Returns:
An array object.

newInstance

public static Object newInstance(IlrType componentType,
                                 int[] dimensions)
                          throws IllegalArgumentException,
                                 NegativeArraySizeException
Deprecated. As of JRules 6.5, use IlrReflect.newArrayInstance(ilog.rules.bom.IlrType, int[]) instead.

Creates a multi-dimensional array of type componentType.

Throws:
NegativeArraySizeException - If the passed length is negative.
IllegalArgumentException
Parameters:
componentType - The component type.
dimensions - The dimensions of the array.
Returns:
An array object.

getLength

public static int getLength(Object array)
                     throws IllegalArgumentException
Gets the length of an array.

Throws:
IllegalArgumentException
Parameters:
array - An array object.
Returns:
The length of the array.

get

public static Object get(Object array,
                         int index)
                  throws IllegalArgumentException,
                         ArrayIndexOutOfBoundsException
Gets an element of an array.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
Returns:
The array element at the specified index.

getBoolean

public static boolean getBoolean(Object array,
                                 int index)
                          throws IllegalArgumentException,
                                 ArrayIndexOutOfBoundsException
Gets an element of an array as a boolean value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
Returns:
The array element at the specified index.
See Also:
get(java.lang.Object,int)

getChar

public static char getChar(Object array,
                           int index)
                    throws IllegalArgumentException,
                           ArrayIndexOutOfBoundsException
Gets an element of an array as a char value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
Returns:
The array element at the specified index.
See Also:
get(java.lang.Object,int)

getByte

public static byte getByte(Object array,
                           int index)
                    throws IllegalArgumentException,
                           ArrayIndexOutOfBoundsException
Gets an element of an array as a byte value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
Returns:
The array element at the specified index.
See Also:
get(java.lang.Object,int)

getShort

public static short getShort(Object array,
                             int index)
                      throws IllegalArgumentException,
                             ArrayIndexOutOfBoundsException
Gets an element of an array as a short value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
Returns:
The array element at the specified index.
See Also:
get(java.lang.Object,int)

getInt

public static int getInt(Object array,
                         int index)
                  throws IllegalArgumentException,
                         ArrayIndexOutOfBoundsException
Gets an element of an array as an int value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
Returns:
The array element at the specified index.
See Also:
get(java.lang.Object,int)

getLong

public static long getLong(Object array,
                           int index)
                    throws IllegalArgumentException,
                           ArrayIndexOutOfBoundsException
Gets an element of an array as a long value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
Returns:
The array element at the specified index.
See Also:
get(java.lang.Object,int)

getFloat

public static float getFloat(Object array,
                             int index)
                      throws IllegalArgumentException,
                             ArrayIndexOutOfBoundsException
Gets an element of an array as a float value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
Returns:
The array element at the specified index.
See Also:
get(java.lang.Object,int)

getDouble

public static double getDouble(Object array,
                               int index)
                        throws IllegalArgumentException,
                               ArrayIndexOutOfBoundsException
Gets an element of an array as a double value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
Returns:
The array element at the specified index.
See Also:
get(java.lang.Object,int)

set

public static void set(Object array,
                       int index,
                       Object value)
                throws IllegalArgumentException,
                       ArrayIndexOutOfBoundsException
Sets an element of an array to a value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
value - The value of the element.

setBoolean

public static void setBoolean(Object array,
                              int index,
                              boolean value)
                       throws IllegalArgumentException,
                              ArrayIndexOutOfBoundsException
Sets an element of an array to a boolean value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
value - The value of the element.
See Also:
set(java.lang.Object,int,java.lang.Object)

setChar

public static void setChar(Object array,
                           int index,
                           char c)
                    throws IllegalArgumentException,
                           ArrayIndexOutOfBoundsException
Sets an element of an array to a char value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
c - The value of the element.
See Also:
set(java.lang.Object,int,java.lang.Object)

setByte

public static void setByte(Object array,
                           int index,
                           byte b)
                    throws IllegalArgumentException,
                           ArrayIndexOutOfBoundsException
Sets an element of an array to a byte value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
b - The value of the element.
See Also:
set(java.lang.Object,int,java.lang.Object)

setShort

public static void setShort(Object array,
                            int index,
                            short s)
                     throws IllegalArgumentException,
                            ArrayIndexOutOfBoundsException
Sets an element of an array to a short value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
s - The value of the element.
See Also:
set(java.lang.Object,int,java.lang.Object)

setInt

public static void setInt(Object array,
                          int index,
                          int i)
                   throws IllegalArgumentException,
                          ArrayIndexOutOfBoundsException
Sets an element of an array to an int value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
i - The value of the element.
See Also:
set(java.lang.Object,int,java.lang.Object)

setLong

public static void setLong(Object array,
                           int index,
                           long l)
                    throws IllegalArgumentException,
                           ArrayIndexOutOfBoundsException
Sets an element of an array to a long value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
l - The value of the element.
See Also:
set(java.lang.Object,int,java.lang.Object)

setFloat

public static void setFloat(Object array,
                            int index,
                            float f)
                     throws IllegalArgumentException,
                            ArrayIndexOutOfBoundsException
Sets an element of an array to a float value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
f - The value of the element.
See Also:
set(java.lang.Object,int,java.lang.Object)

setDouble

public static void setDouble(Object array,
                             int index,
                             double d)
                      throws IllegalArgumentException,
                             ArrayIndexOutOfBoundsException
Sets an element of an array to a double value.

Throws:
ArrayIndexOutOfBoundsException - If the passed index is greater than the array length.
IllegalArgumentException
Parameters:
array - An array object.
index - The index of the element to get.
d - The value of the element.
See Also:
set(java.lang.Object,int,java.lang.Object)

Rule Execution Server API

© Copyright IBM Corp. 1987, 2013