korat.finitization.impl
Class ClassDomain

java.lang.Object
  extended by korat.finitization.impl.ClassDomain
All Implemented Interfaces:
IClassDomain
Direct Known Subclasses:
NullClassDomain

public class ClassDomain
extends Object
implements IClassDomain

Author:
Aleksandar Milicevic

Field Summary
private  Class<?> classOfObjects
           
protected  Constructor constructor
           
protected  boolean initialized
           
private  boolean isomorphismCheck
           
(package private)  int numOfObjects
           
private  List<Object> objects
           
protected  Object[] params
           
 
Constructor Summary
ClassDomain(Class<?> classOfObjects)
           
ClassDomain(Class<?> classOfObjects, int numOfObjects)
           
ClassDomain(String classOfObjectsName, int numOfObjects)
          Helper.
 
Method Summary
 void addObject(Object o)
          Add existing object into class domain.
 void addObjects(Collection col)
          Add all objects of the existing collection to the class domain
 void addObjects(Object[] objs)
          Add all objects of the existing array to the class domain
private  boolean checkObjIndex(int ind)
           
 boolean contains(Object obj)
          Checks whether the object obj is the member of this class domain
private  boolean defaultIsomorphismCheck(Class<?> clazz)
           
 boolean equals(Object other)
           
 String getClassNameOfObjects()
          Returns the name of class type for this domain Equal to {IClassDomain}.getClassOfObjects.getName();
 Class<?> getClassOfObjects()
          Returns the Class object for elements of this Domain
 int getIndexOf(Object obj)
          Returns index of object obj in this class domain
 Object getObject(int index)
          Returns object stored at a given position inside the class domain
 List<Object> getObjects()
           
 int getSize()
          Returns number of objects in this class domain
 int hashCode()
           
 void includeInIsomorphismCheck(boolean include)
           If this option is set, the class domain will be included in isomorphism checking.
 void initialize()
          Creates all uncreated objects.
 boolean isIncludedInIsomorphismChecking()
           
 boolean isInitialized()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

classOfObjects

private final Class<?> classOfObjects

objects

private List<Object> objects

initialized

protected boolean initialized

numOfObjects

int numOfObjects

constructor

protected Constructor constructor

params

protected Object[] params

isomorphismCheck

private boolean isomorphismCheck
Constructor Detail

ClassDomain

ClassDomain(Class<?> classOfObjects,
            int numOfObjects)
Parameters:
classOfObjects - - type of objects, has to be a Class object of a class
numOfObjects - - number of objects of classOfObject type to be created

ClassDomain

ClassDomain(String classOfObjectsName,
            int numOfObjects)
      throws ClassNotFoundException
Helper.

Parameters:
classOfObjectsName - - fully qualified name of the Class of the objects
numOfObjects - - number of objects to be created
Throws:
ClassNotFoundException - - throws if classOfObjectName is not valid

ClassDomain

ClassDomain(Class<?> classOfObjects)
Method Detail

checkObjIndex

private boolean checkObjIndex(int ind)

defaultIsomorphismCheck

private boolean defaultIsomorphismCheck(Class<?> clazz)

getClassOfObjects

public Class<?> getClassOfObjects()
Description copied from interface: IClassDomain
Returns the Class object for elements of this Domain

Specified by:
getClassOfObjects in interface IClassDomain

getClassNameOfObjects

public String getClassNameOfObjects()
Description copied from interface: IClassDomain
Returns the name of class type for this domain

Equal to {IClassDomain}.getClassOfObjects.getName();

Specified by:
getClassNameOfObjects in interface IClassDomain

getSize

public int getSize()
Description copied from interface: IClassDomain
Returns number of objects in this class domain

Specified by:
getSize in interface IClassDomain

initialize

public void initialize()
Creates all uncreated objects. Constructor used for creation is className(ITester interface); constructor

Size and other properties of class domain should be set before calling this method, through constructor or some specialized interface.


isInitialized

public boolean isInitialized()

getObject

public Object getObject(int index)
Returns object stored at a given position inside the class domain


getObjects

public List<Object> getObjects()
Returns:
list of all objects in this class domain

getIndexOf

public int getIndexOf(Object obj)
Returns index of object obj in this class domain


contains

public boolean contains(Object obj)
Checks whether the object obj is the member of this class domain


equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

includeInIsomorphismCheck

public void includeInIsomorphismCheck(boolean include)
Description copied from interface: IClassDomain

If this option is set, the class domain will be included in isomorphism checking. It means, that in case where one object from this class domain is used as a value for some field, it and all objects from this class domain with lower indices, will not be used as a value for any other field in current candidate.

By default, all class domains are included in isomorphism checking

Specified by:
includeInIsomorphismCheck in interface IClassDomain
Parameters:
include - - true if the class domain should be included in isomorphism checking

isIncludedInIsomorphismChecking

public boolean isIncludedInIsomorphismChecking()
Specified by:
isIncludedInIsomorphismChecking in interface IClassDomain
Returns:
is this class domain is included in isomorphism check

addObject

public void addObject(Object o)
Description copied from interface: IClassDomain
Add existing object into class domain. The added object is already initialized and initialize operation will not affect it.

Specified by:
addObject in interface IClassDomain
Parameters:
o - - object to be added, null is not allowed

addObjects

public void addObjects(Object[] objs)
Description copied from interface: IClassDomain
Add all objects of the existing array to the class domain

Specified by:
addObjects in interface IClassDomain
Parameters:
objs - - array of objects, null is not allowed

addObjects

public void addObjects(Collection col)
Description copied from interface: IClassDomain
Add all objects of the existing collection to the class domain

Specified by:
addObjects in interface IClassDomain
Parameters:
col - - collection of objects, null is not allowed

toString

public String toString()
Overrides:
toString in class Object