korat.instrumentation
Class KoratArrayManager

java.lang.Object
  extended by korat.instrumentation.KoratArrayManager

public final class KoratArrayManager
extends Object

Class KoratArrayManager provides some helper methods for creation and manipulation of automatically generated array classes and objects

Author:
Sasa Misailovic

Constructor Summary
private KoratArrayManager()
          creation of instances not allowed
 
Method Summary
static IKoratArray createArray(Class<?> koratArrayClz, int size)
          Creates instance of koratArrayClz
static IKoratArray createArray(Class<?> elementType, int size, int iselemtype)
          Creates instance of KorratArray_Type class based on given array component type.
static Class createArrayClass(Class arrayClass)
          Creates KorratArray_Type class based on existing array type.
static int getArrayLength(Object koratArrayObj)
           
static Object[] getArrayValues(Object koratArray)
           
static Object[] getArrayValues(Object obj, String name)
           
static Setter getElementSetter(Object array, int elemIndex, int elem_id)
          Returns ElementSetter
static Setter getLengthSetter(Object array, int len_id)
          Returns length setter
static void initializeArray(IKoratArray array, ITester tcListener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KoratArrayManager

private KoratArrayManager()
creation of instances not allowed

Method Detail

createArrayClass

public static Class createArrayClass(Class arrayClass)
                              throws Exception
Creates KorratArray_Type class based on existing array type. Type is type of array components

Parameters:
arrayClass - - array class for which corresponding KoratArray_Type will be generated
Returns:
- Generated KoratArray_Type Class
Throws:
Exception

createArray

public static IKoratArray createArray(Class<?> koratArrayClz,
                                      int size)
                               throws Exception
Creates instance of koratArrayClz

Parameters:
koratArrayClz - - array class for which corresponding KoratArray_Type will be generated
Returns:
- Generated KoratArray_Type Class
Throws:
Exception

createArray

public static IKoratArray createArray(Class<?> elementType,
                                      int size,
                                      int iselemtype)
                               throws Exception
Creates instance of KorratArray_Type class based on given array component type. Type is type of array components

Parameters:
elementType - - component class for which corresponding KoratArray_Type will be generated
size - - maximal size of KoratArray_Type
iselemtype - - any value
Returns:
- Object of generated KoratArray_Type Class
Throws:
Exception

initializeArray

public static void initializeArray(IKoratArray array,
                                   ITester tcListener)

getElementSetter

public static Setter getElementSetter(Object array,
                                      int elemIndex,
                                      int elem_id)
Returns ElementSetter


getLengthSetter

public static Setter getLengthSetter(Object array,
                                     int len_id)
Returns length setter


getArrayValues

public static Object[] getArrayValues(Object koratArray)

getArrayValues

public static Object[] getArrayValues(Object obj,
                                      String name)
Parameters:
obj - - object that contains field of the class name
name - - name of the array field
Returns:
values of the array as an Object array. For primitive types, automatic wrapper classes are returned as array elements.

getArrayLength

public static int getArrayLength(Object koratArrayObj)