korat.finitization.impl
Class ArraySet

java.lang.Object
  extended by korat.finitization.impl.FieldDomain
      extended by korat.finitization.impl.ArraySet
All Implemented Interfaces:
IArraySet, IFieldDomain

public class ArraySet
extends FieldDomain
implements IArraySet

Author:
Sasa Misailovic

Field Summary
private  ClassDomain arrays
           
protected  IntSet lengthsSet
           
protected  FieldDomain valuesSet
           
 
Fields inherited from class korat.finitization.impl.FieldDomain
classOfField
 
Constructor Summary
ArraySet(ClassDomain arrays, IntSet lengthsSet, FieldDomain valuesSet)
           
 
Method Summary
 Object getArray(int index)
          Returns the array at position index in this field domain.
 IIntSet getArraySizes()
          Gets the domain for the size of the array.
 ClassDomain getClassDomain(int classDomainIndex)
          Returns the class domain for the given index

primitive types should return null.

 ClassDomain getClassDomainFor(int objectIndex)
          Finds the class domain for given object index by calling getClassDomainFor(objectIndex) and returns the following class domain.
 int getClassDomainIndexFor(int objectIndex)
          Given the index of object in this field domain, returns index of that object in its class domain.
 IFieldDomain getComponentsSet()
          Gets the class domain of array components in this IArraySet.
 int getIndexOfFirstObjectInNextClassDomain(int objectIndex)
           
 int getMaxLength()
          Returns maximal length of array objects in this IArraySet.
 ClassDomain getNextClassDomainFor(int objectIndex)
          Finds the class domain for given object index by calling getClassDomainFor(objectIndex) and returns the following class domain.
 int getNumberOfElements()
          Number of all elements in this field domain.
 int getNumOfClassDomains()
          Number of class domains contained in this field domain.
 int getSizeOfClassDomain(int classDomainIndex)
          Number of object in the class domain which is at a classDomainIndex position in the list of all class domains within this field domain.
 boolean isArrayType()
          Does this field domain represent array type.
 boolean isPrimitiveType()
          Does this field domain represent primitive type.
 void setArraySizes(IIntSet sizes)
          Sets domain for the size of the array.
 void setComponentsSet(IFieldDomain componentsSet)
          Sets the field domain for the components of the array.
 
Methods inherited from class korat.finitization.impl.FieldDomain
checkClassDomainIndex, checkObjectIndex, getClassOfField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface korat.finitization.IFieldDomain
getClassOfField
 

Field Detail

lengthsSet

protected IntSet lengthsSet

valuesSet

protected FieldDomain valuesSet

arrays

private ClassDomain arrays
Constructor Detail

ArraySet

public ArraySet(ClassDomain arrays,
                IntSet lengthsSet,
                FieldDomain valuesSet)
Method Detail

getArray

public Object getArray(int index)
Returns the array at position index in this field domain.

Parameters:
index - - index of array in field domain's list
Returns:
- array at position index in this field domain

getClassDomain

public ClassDomain getClassDomain(int classDomainIndex)
Description copied from class: FieldDomain
Returns the class domain for the given index

primitive types should return null.

Specified by:
getClassDomain in class FieldDomain
Parameters:
classDomainIndex - - the index of the class domain
Returns:
class domain

getClassDomainFor

public ClassDomain getClassDomainFor(int objectIndex)
Description copied from class: FieldDomain
Finds the class domain for given object index by calling getClassDomainFor(objectIndex) and returns the following class domain.

Primitive types should return null.

Specified by:
getClassDomainFor in class FieldDomain
Parameters:
objectIndex - - the index of the given object
Returns:
the class domain following the class domain that contains given object.
See Also:


getClassDomainIndexFor

public int getClassDomainIndexFor(int objectIndex)
Description copied from class: FieldDomain
Given the index of object in this field domain, returns index of that object in its class domain.

For primitive types it's the same as the input parameter objectIndex because primitive type field domains conceptually contain exactly one class domain.

Specified by:
getClassDomainIndexFor in class FieldDomain
Parameters:
objectIndex - - index of object in the field domain
Returns:
index of object in its class domain

getIndexOfFirstObjectInNextClassDomain

public int getIndexOfFirstObjectInNextClassDomain(int objectIndex)
Specified by:
getIndexOfFirstObjectInNextClassDomain in class FieldDomain

getNextClassDomainFor

public ClassDomain getNextClassDomainFor(int objectIndex)
Description copied from class: FieldDomain
Finds the class domain for given object index by calling getClassDomainFor(objectIndex) and returns the following class domain.

Primitive typess should return null.

Specified by:
getNextClassDomainFor in class FieldDomain
Parameters:
objectIndex - - the index of the given object
Returns:
the class domain following the class domain that contains given object.
See Also:


getNumOfClassDomains

public int getNumOfClassDomains()
Description copied from class: FieldDomain
Number of class domains contained in this field domain.

Primitive types should return 1.

Specified by:
getNumOfClassDomains in interface IFieldDomain
Specified by:
getNumOfClassDomains in class FieldDomain
Returns:
number of class domains in this field domain
See Also:
IPrimitiveTypeSet

getNumberOfElements

public int getNumberOfElements()
Description copied from class: FieldDomain
Number of all elements in this field domain. These are all elements that can be assigned to a field associated with this field domain in the process of generating test cases.

Specified by:
getNumberOfElements in interface IFieldDomain
Specified by:
getNumberOfElements in class FieldDomain
Returns:
overall number of elements in field domain

getSizeOfClassDomain

public int getSizeOfClassDomain(int classDomainIndex)
Description copied from class: FieldDomain
Number of object in the class domain which is at a classDomainIndex position in the list of all class domains within this field domain.

Primitive types should return -1 if classDomainIndex is different than 0, or getNumberOfElements() else.

Specified by:
getSizeOfClassDomain in class FieldDomain
Parameters:
classDomainIndex - - class domain index
Returns:
number of objects in domain with index classDomainIndex
See Also:


getArraySizes

public IIntSet getArraySizes()
Description copied from interface: IArraySet
Gets the domain for the size of the array.

Specified by:
getArraySizes in interface IArraySet
Returns:
class domain containing ints - all possible sizes of the array.

getComponentsSet

public IFieldDomain getComponentsSet()
Description copied from interface: IArraySet
Gets the class domain of array components in this IArraySet.

Specified by:
getComponentsSet in interface IArraySet
Returns:
IClassDomain that has been assigned for the components of the arrays in this IArraySet.

setArraySizes

public void setArraySizes(IIntSet sizes)
Description copied from interface: IArraySet
Sets domain for the size of the array. Bounds this IArraySet only to arrays of the given sizes.

Specified by:
setArraySizes in interface IArraySet
Parameters:
sizes - all possible values for the size of the array

setComponentsSet

public void setComponentsSet(IFieldDomain componentsSet)
Description copied from interface: IArraySet
Sets the field domain for the components of the array. Each component of the array within this IArraySet is bounded by elements of the given componentSet.

Specified by:
setComponentsSet in interface IArraySet
Parameters:
componentsSet - set of values that array components within this IArraySet can take, either ObjSet in case the type array components is reference type, or field domain of corresponding primitive type.

getMaxLength

public int getMaxLength()
Returns maximal length of array objects in this IArraySet.


isArrayType

public boolean isArrayType()
Description copied from interface: IFieldDomain
Does this field domain represent array type.

Specified by:
isArrayType in interface IFieldDomain
Returns:
true if class of this FieldDomain is array, false otherwise

isPrimitiveType

public boolean isPrimitiveType()
Description copied from interface: IFieldDomain
Does this field domain represent primitive type.

Specified by:
isPrimitiveType in interface IFieldDomain
Returns:
true for primitive data types and strings, false otherwise