|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectkorat.finitization.impl.Finitization
public class Finitization
| Field Summary | |
|---|---|
private Map<Class<?>,IClassDomain> |
classDomains
|
protected static ClassLoader |
classLoader
|
private Map<IClassDomain,Map<String,IFieldDomain>> |
clsDomainsMap
|
private boolean |
handleArraysAsObjects
|
private List<Finitization> |
includedFinitizations
|
private Class |
rootClass
|
private ClassDomain |
rootClassDomain
|
private StateSpace |
stateSpace
|
| Constructor Summary | |
|---|---|
Finitization(Class myClass)
|
|
| Method Summary | |
|---|---|
void |
addAll(Class cls,
String fieldName,
IObjSet objSet)
Adds all objects from the given objSet to the given field
which has to be of type Collection. |
void |
addAll(String fullFieldName,
IObjSet objSet)
Adds all objects from the given objSet to the given field
which has to be of type Collection. |
void |
addAll(String className,
String fieldName,
IObjSet objSet)
Adds all objects from the given objSet to the given field
which has to be of type Collection. |
private void |
appendClassDomain(List<CVElem> list,
ClassDomain cd)
|
private void |
appendFields(List<CVElem> fieldsList,
Object obj,
Map<String,IFieldDomain> fieldsMap)
|
boolean |
areArraysHandledAsObjects()
|
IArraySet |
createArraySet(Class clz,
IIntSet array$length,
IFieldDomain array$values,
int count)
Creates an instance of the IArraySet. |
IBooleanSet |
createBooleanSet()
Creates new IBooleanSet |
IByteSet |
createByteSet(byte singleValue)
Creates IByteSet with the single value that is given as
the method parameter. |
IByteSet |
createByteSet(byte min,
byte max)
Here the step (differecte) between two consecutive values in the set defaults to 1. |
IByteSet |
createByteSet(byte min,
byte diff,
byte max)
|
IClassDomain |
createClassDomain(Class cls)
Creates new empty class domain Equivalent to createClassDomain(cls, 0); |
IClassDomain |
createClassDomain(Class cls,
int numOfInstances)
Creates new ClassDomain if the ClassDomain
with the given Class hasn't already been created or
returns existing ClassDomain, no matter if it's size is
different from the given parameter numOfInstances |
IClassDomain |
createClassDomain(String className)
Equivalent to createClassDomain(className) |
IClassDomain |
createClassDomain(String className,
int numOfInstances)
Helper. |
IDoubleSet |
createDoubleSet(double singleValue)
Creates IDoubleSet with the single value that is given as
the method parameter. |
IDoubleSet |
createDoubleSet(double min,
double max)
Here the step (differecte) between two consecutive values in the set defaults to 1. |
IDoubleSet |
createDoubleSet(double min,
double diff,
double max)
|
IFloatSet |
createFloatSet(float singleValue)
Creates IFloatSet with the single value that is given as
the method parameter. |
IFloatSet |
createFloatSet(float min,
float max)
Here the step (differecte) between two consecutive values in the set defaults to 1. |
IFloatSet |
createFloatSet(float min,
float diff,
float max)
Here the step (differecte) between two consecutive values in the set defaults to 1. |
IIntSet |
createIntSet(int singleValue)
Creates IIntSet with the single value that is given as the
method parameter. |
IIntSet |
createIntSet(int min,
int max)
Creates IIntSet with the given min and
max parameters. |
IIntSet |
createIntSet(int min,
int diff,
int max)
Creates IIntSet according to the given parameters. |
ILongSet |
createLongSet(long singleValue)
Creates ILongSet with the single value that is given as
the method parameter. |
ILongSet |
createLongSet(long min,
long max)
Here the step (differecte) between two consecutive values in the set defaults to 1. |
ILongSet |
createLongSet(long min,
long diff,
long max)
|
IObjSet |
createObjSet(Class fieldBaseClass)
Helper. |
IObjSet |
createObjSet(Class fieldBaseClass,
boolean includeNull)
Creates IObjSet according to the given parameters. |
IObjSet |
createObjSet(Class fieldBaseClass,
int numOfInstances)
Helper. |
IObjSet |
createObjSet(Class fieldBaseClass,
int numOfInstances,
boolean includeNull)
Creates IObjSet and automatically creates given number of
instances of the same class
Equivalent to IClassDomain c = f.createClassDomain(fieldBaseClass, numOfInstances); IObjSet toReturn = f.createObjSet(fieldBaseClass, includeNull); toReturn.addClassDomain(c); return toReturn; |
IFieldDomain |
createObjSet(IClassDomain classDomain)
Helper. |
IFieldDomain |
createObjSet(IClassDomain classDomain,
boolean includeNull)
Similar to createObjSet(IClassDomain classDomain)
but also can include null value |
IObjSet |
createObjSet(String fieldBaseClassName)
Helper. |
IObjSet |
createObjSet(String fieldBaseClassName,
boolean includeNull)
Helper. |
IObjSet |
createObjSet(String fieldBaseClassName,
int numOfInstances)
Helper. |
IObjSet |
createObjSet(String fieldBaseClassName,
int numOfInstances,
boolean includeNull)
Helper. |
IShortSet |
createShortSet(short singleValue)
Creates IShortSet with the single value that is given as
the method parameter. |
IShortSet |
createShortSet(short min,
short max)
Here the step (differecte) between two consecutive values in the set defaults to 1. |
IShortSet |
createShortSet(short min,
short diff,
short max)
|
private void |
createStateSpace()
|
ClassDomain |
getClassDomain(Class cls)
Searches for the ObjSet of the given Class
object. |
IClassDomain |
getClassDomain(String name)
Helper. |
private Class |
getClassFromName(String className)
|
static ClassLoader |
getClassLoader()
|
IFieldDomain |
getFieldDomain(Class cls,
String fieldName)
|
IFieldDomain |
getFieldDomain(String fullFieldName)
|
IFieldDomain |
getFieldDomain(String className,
String fieldName)
|
Class |
getFinClass()
Returns Class object of the finitized class |
IFinitization |
getIncludedFinitization(Class clazz)
Returns the included finitization, if there is such, for type given by clazz parameter |
int[] |
getInitialCandidateVector()
|
StateSpace |
getStateSpace()
Returns the IStateSpace according to the bounds of the
system |
void |
handleArraysAsObjects(boolean handleAsObjects)
If selected, arrays will be handled like other objects during Korat search. |
boolean |
includeFinitization(IFinitization ifin)
Includes information from finitization fin into current
finitization. |
void |
initialize()
Does all needed initialization. |
private void |
initializeClassDomains()
|
private void |
initializeFieldSetters()
|
private String |
parseClassName(String fullFieldName)
|
private String |
parseFieldName(String fullFieldName)
|
private Map<String,IFieldDomain> |
putClsDomainsMap(IClassDomain cd,
Map<String,IFieldDomain> mfd)
|
void |
set(Class cls,
String fieldName,
IFieldDomain fieldDomain)
Assigns fieldDomain to the given field (fieldName)
of the given class (cls). |
void |
set(String fullFieldName,
IFieldDomain fieldDomain)
Helper. |
void |
set(String className,
String fieldName,
IFieldDomain fieldDomain)
Helper. |
static void |
setClassLoader(ClassLoader classLoader2)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Class rootClass
private ClassDomain rootClassDomain
private Map<IClassDomain,Map<String,IFieldDomain>> clsDomainsMap
private Map<Class<?>,IClassDomain> classDomains
private StateSpace stateSpace
private boolean handleArraysAsObjects
private List<Finitization> includedFinitizations
protected static ClassLoader classLoader
| Constructor Detail |
|---|
public Finitization(Class myClass)
| Method Detail |
|---|
public static void setClassLoader(ClassLoader classLoader2)
public static ClassLoader getClassLoader()
private Class getClassFromName(String className)
private String parseClassName(String fullFieldName)
private String parseFieldName(String fullFieldName)
private Map<String,IFieldDomain> putClsDomainsMap(IClassDomain cd,
Map<String,IFieldDomain> mfd)
private void initializeClassDomains()
private void appendFields(List<CVElem> fieldsList,
Object obj,
Map<String,IFieldDomain> fieldsMap)
private void appendClassDomain(List<CVElem> list,
ClassDomain cd)
private void createStateSpace()
private void initializeFieldSetters()
public boolean areArraysHandledAsObjects()
areArraysHandledAsObjects in interface IFinitizationpublic void handleArraysAsObjects(boolean handleAsObjects)
IFinitizationIf selected, arrays will be handled like other objects during Korat search. This implies that one array object might be shared among many objects.
Another option is to treat array objects as special "field containers", that may belong to only one object.
handleArraysAsObjects in interface IFinitizationhandleAsObjects - - should arrays be treated like objects during search.IFinitization.areArraysHandledAsObjects()public Class getFinClass()
IFinitizationClass object of the finitized class
getFinClass in interface IFinitizationClass object for root class that is being finitized
public IClassDomain createClassDomain(String className,
int numOfInstances)
IFinitizationClass object for the given
className and then calls
createClassDomain(Class, int).
createClassDomain in interface IFinitizationclassName - fully qualified name of the class or relative to the package
name of the finitized class.numOfInstances - number of elements to be created
IClassDomainIFinitization.createClassDomain(Class, int)
public IClassDomain createClassDomain(Class cls,
int numOfInstances)
IFinitizationClassDomain if the ClassDomain
with the given Class hasn't already been created or
returns existing ClassDomain, no matter if it's size is
different from the given parameter numOfInstances
createClassDomain in interface IFinitizationcls - Class of the objectsnumOfInstances - number of instances to be created
IClassDomainIFinitization.createClassDomain(String, int)public IBooleanSet createBooleanSet()
IFinitizationIBooleanSet
createBooleanSet in interface IFinitizationIBooleanSet
public IIntSet createIntSet(int min,
int diff,
int max)
IFinitizationIIntSet according to the given parameters.
createIntSet in interface IFinitizationmin - minimal element of this set of integers (included)diff - step, the difference between to elementsmax - maximal element of this set of integers (included)
IIntSetIFinitization.createIntSet(int),
IFinitization.createIntSet(int, int)
public IIntSet createIntSet(int min,
int max)
IFinitizationIIntSet with the given min and
max parameters. The difference between two elements is by
default 1. Equivalent of createIntSet(min, 1, max).
createIntSet in interface IFinitizationmin - minimal element of this set of integers (included)max - maximal element of this set of integers (included)
IIntSetIFinitization.createIntSet(int),
IFinitization.createIntSet(int, int, int)public IIntSet createIntSet(int singleValue)
IFinitizationIIntSet with the single value that is given as the
method parameter. Equivalent of
createIntSet(value, 1, value).
createIntSet in interface IFinitizationsingleValue - single value that will be added to IIntSet
IIntSetIFinitization.createIntSet(int, int),
IFinitization.createIntSet(int, int, int)
public IByteSet createByteSet(byte min,
byte diff,
byte max)
createByteSet in interface IFinitizationmin - - minimum value to be included in the setdiff - - difference (step) between two consecutive values in the setmax - - maximum value to be included in the set
IByteSet
public IByteSet createByteSet(byte min,
byte max)
IFinitization
createByteSet in interface IFinitizationmin - - minimum value to be included in the setmax - - maximum value to be included in the set
IByteSetpublic IByteSet createByteSet(byte singleValue)
IFinitizationIByteSet with the single value that is given as
the method parameter. Equivalent of
createByteSet(value, 1, value).
createByteSet in interface IFinitizationsingleValue - single value that will be added to IByteSet
IByteSetIFinitization.createByteSet(byte, byte),
IFinitization.createByteSet(byte, byte, byte)
public IDoubleSet createDoubleSet(double min,
double diff,
double max)
createDoubleSet in interface IFinitizationmin - - minimum value to be included in the setdiff - - difference (step) between two consecutive values in the setmax - - maximum value to be included in the set
IDoubleSet
public IDoubleSet createDoubleSet(double min,
double max)
IFinitization
createDoubleSet in interface IFinitizationmin - - minimum value to be included in the setmax - - maximum value to be included in the set
IDoubleSetpublic IDoubleSet createDoubleSet(double singleValue)
IFinitizationIDoubleSet with the single value that is given as
the method parameter. Equivalent of
createDoubleSet(value, 1, value).
createDoubleSet in interface IFinitizationsingleValue - single value that will be added to IDoubleSet
IDoubletSetIFinitization.createDoubleSet(double, double),
IFinitization.createDoubleSet(double, double, double)
public IFloatSet createFloatSet(float min,
float diff,
float max)
IFinitization
createFloatSet in interface IFinitizationmin - - minimum value to be included in the setmax - - maximum value to be included in the set
IFloatSet
public IFloatSet createFloatSet(float min,
float max)
IFinitization
createFloatSet in interface IFinitizationmin - - minimum value to be included in the setmax - - maximum value to be included in the set
IFloatSetpublic IFloatSet createFloatSet(float singleValue)
IFinitizationIFloatSet with the single value that is given as
the method parameter. Equivalent of
createFloatSet(value, 1, value).
createFloatSet in interface IFinitizationsingleValue - single value that will be added to IFloatSet
IFloatSetIFinitization.createFloatSet(float, float),
IFinitization.createFloatSet(float, float, float)
public ILongSet createLongSet(long min,
long diff,
long max)
createLongSet in interface IFinitizationmin - - minimum value to be included in the setdiff - - difference (step) between two consecutive values in the setmax - - maximum value to be included in the set
ILongSet
public ILongSet createLongSet(long min,
long max)
IFinitization
createLongSet in interface IFinitizationmin - - minimum value to be included in the setmax - - maximum value to be included in the set
ILongSetpublic ILongSet createLongSet(long singleValue)
IFinitizationILongSet with the single value that is given as
the method parameter. Equivalent of
createLongSet(value, 1, value).
createLongSet in interface IFinitizationsingleValue - single value that will be added to ILongSet
ILongSetIFinitization.createLongSet(long, long),
IFinitization.createLongSet(long, long, long)
public IShortSet createShortSet(short min,
short diff,
short max)
createShortSet in interface IFinitizationmin - - minimum value to be included in the setdiff - - difference (step) between two consecutive values in the setmax - - maximum value to be included in the set
IShortSet
public IShortSet createShortSet(short min,
short max)
IFinitization
createShortSet in interface IFinitizationmin - - minimum value to be included in the setmax - - maximum value to be included in the set
IShortSetpublic IShortSet createShortSet(short singleValue)
IFinitizationIShortSet with the single value that is given as
the method parameter. Equivalent of
createShortSet(value, 1, value).
createShortSet in interface IFinitizationsingleValue - single value that will be added to IShortSet
IShortSetIFinitization.createShortSet(short, short),
IFinitization.createShortSet(short, short, short)
public IObjSet createObjSet(Class fieldBaseClass,
boolean includeNull)
IFinitizationIObjSet according to the given parameters.
createObjSet in interface IFinitizationfieldBaseClass - Base type of the field that is used in type checking. If
fieldBaseClass is a Class object
of a reference type, new IObjSet will be
returned, else an exception will be thrown.includeNull - whether to include null in the IObjSet.
IObjSetIFinitization.createObjSet(Class),
IFinitization.createObjSet(String),
IFinitization.createObjSet(String, boolean)public IObjSet createObjSet(Class fieldBaseClass)
IFinitizationcreateObjSet(fieldBaseClass, false);
createObjSet in interface IFinitizationfieldBaseClass - Base type of the field
IObjSetIFinitization.createObjSet(Class, boolean),
IFinitization.createObjSet(String),
IFinitization.createObjSet(String, boolean)
public IObjSet createObjSet(String fieldBaseClassName,
boolean includeNull)
IFinitizationClass object for the given
fieldBaseClassName and then calls
createObjSet(Class, boolean).
createObjSet in interface IFinitizationfieldBaseClassName - name of the base type of the fieldincludeNull - weather to include null in the IObjSet.
IObjSetIFinitization.createObjSet(Class, boolean),
IFinitization.createObjSet(Class),
IFinitization.createObjSet(String)public IObjSet createObjSet(String fieldBaseClassName)
IFinitizationcreateFieldDomain(fieldBaseClassName, false);
- Specified by:
createObjSet in interface IFinitization
- Parameters:
fieldBaseClassName - name of the base type of the field
- Returns:
- created
IObjSet - See Also:
IFinitization.createObjSet(Class, boolean),
IFinitization.createObjSet(Class),
IFinitization.createObjSet(String, boolean)
public IFieldDomain createObjSet(IClassDomain classDomain)
IFinitizationclassDomain
and adds classDomain. Null value is not allowed
createObjSet in interface IFinitizationIFieldDomain
public IFieldDomain createObjSet(IClassDomain classDomain,
boolean includeNull)
IFinitizationcreateObjSet(IClassDomain classDomain)
but also can include null value
createObjSet in interface IFinitizationIFieldDomainIFinitization.createObjSet(IClassDomain)
public void set(Class cls,
String fieldName,
IFieldDomain fieldDomain)
IFinitizationfieldDomain to the given field (fieldName)
of the given class (cls).createObjSet(cls, numOfInstances))
set in interface IFinitizationcls - -
Class object of the classfieldName - -
field name of the given classfieldDomain - -
domain of the fieldIFinitization.set(String, IFieldDomain),
IFinitization.set(String, String, IFieldDomain)
public void set(String className,
String fieldName,
IFieldDomain fieldDomain)
IFinitizationset(Class, String, IFieldDomain)
set in interface IFinitizationclassName - -
fully qualified name of the class or name relative to package
name of the finitized classfieldName - -
name of the fieldfieldDomain - -
domain of the fieldIFinitization.set(String, IFieldDomain),
IFinitization.set(Class, String, IFieldDomain)
public void set(String fullFieldName,
IFieldDomain fieldDomain)
IFinitizationfullFieldName into
className and fieldName according to
following format:fullFieldName does not contains "." it is
considered as a fieldName of the class which this
finitization is for;fullFieldName contains "." then the substring
after the last "." in the fullFieldName is considered as a
fieldName and the substring before the last "." is taken
as className. className should be a fully
qualified name of the class or a relative name in the package of the
finitized field;set(className, fieldName, fieldDomain)
set in interface IFinitizationfullFieldName - -
name of the field ( format: ClassName.FieldName )fieldDomain - -
field domainIFinitization.set(Class, String, IFieldDomain),
IFinitization.set(String, String, IFieldDomain)public ClassDomain getClassDomain(Class cls)
IFinitizationObjSet of the given Class
object.
getClassDomain in interface IFinitizationcls - -
Class object of the class
ObjSet for the given class name or null if is
not been created yet.- See Also:
IFinitization.getClassDomain(String)public IClassDomain getClassDomain(String name)
IFinitizationClass object of the class
with the given name and then calls getObjSet(Class)
getClassDomain in interface IFinitizationname - -
name of the class of which the ObjSet is
requested.
ObjSet for the given class name or null if is
not been created yet.- See Also:
IFinitization.getClassDomain(Class)
public IFieldDomain getFieldDomain(Class cls,
String fieldName)
getFieldDomain in interface IFinitizationIFieldDomainIFinitization.getFieldDomain(String),
IFinitization.getFieldDomain(String, String)
public IFieldDomain getFieldDomain(String className,
String fieldName)
getFieldDomain in interface IFinitizationIFieldDomainIFinitization.getFieldDomain(Class, String),
IFinitization.getFieldDomain(String)public IFieldDomain getFieldDomain(String fullFieldName)
getFieldDomain in interface IFinitizationIFieldDomainIFinitization.getFieldDomain(Class, String),
IFinitization.getFieldDomain(String, String)public StateSpace getStateSpace()
IStateSpace according to the bounds of the
system
public void initialize()
StateSpace
public IArraySet createArraySet(Class clz,
IIntSet array$length,
IFieldDomain array$values,
int count)
IFinitizationCreates an instance of the IArraySet.
Use this method to create a field domain for the field of an array type.
If the given parameter doesn't stand clz.isArray() an
IllegalArgumentException will be thrown. The other two
parameters are used to set bounds on array length and array components.
An array will take any int value from the given
IIntSet array$length parameter and any of the array
components will take any value from the given
IFieldDomain array$values
createArraySet in interface IFinitizationclz - class of the array fieldarray$length - possible values for the array lengtharray$values - possible values for the array componentscount - number of arrays to create
public IClassDomain createClassDomain(String className)
IFinitizationcreateClassDomain(className)
createClassDomain in interface IFinitizationIClassDomainIFinitization.createClassDomain(String, int)public IClassDomain createClassDomain(Class cls)
IFinitization
Equivalent to createClassDomain(cls, 0);
createClassDomain in interface IFinitizationcls - Class of the object
IFinitization.createClassDomain(Class, int)
public IObjSet createObjSet(Class fieldBaseClass,
int numOfInstances,
boolean includeNull)
IFinitizationIObjSet and automatically creates given number of
instances of the same class
Equivalent to
IClassDomain c = f.createClassDomain(fieldBaseClass, numOfInstances); IObjSet toReturn = f.createObjSet(fieldBaseClass, includeNull); toReturn.addClassDomain(c); return toReturn;
createObjSet in interface IFinitizationfieldBaseClass - -
class of the fieldnumOfInstances - -
instances of the fieldBaseClass that are to be
created in the class domain of fieldBaseClassincludeNull - -
whether to include null in the IObjSet
IObjSet
public IObjSet createObjSet(Class fieldBaseClass,
int numOfInstances)
IFinitizationClass object for the given
fieldBaseClassName and then calls
createObjSet(Class, int, boolean).
createObjSet in interface IFinitizationIObjSet
public IObjSet createObjSet(String fieldBaseClassName,
int numOfInstances,
boolean includeNull)
IFinitizationClass object for the given
fieldBaseClassName and then calls
createObjSet(Class, int, boolean).
createObjSet in interface IFinitizationIObjSet
public IObjSet createObjSet(String fieldBaseClassName,
int numOfInstances)
IFinitizationcreateObjSet(fieldBaseClassName, numOfInstances, false);
- Specified by:
createObjSet in interface IFinitization
- Returns:
- newly created
IObjSet
public void addAll(String fullFieldName,
IObjSet objSet)
IFinitizationobjSet to the given field
which has to be of type Collection.
addAll in interface IFinitizationfullFieldName - - full name of the field: <className>.<fieldName>objSet - - set of objects to be added to the given field (collection)IFinitization.addAll(Class, String, IObjSet),
IFinitization.addAll(String, String, IObjSet)
public void addAll(String className,
String fieldName,
IObjSet objSet)
IFinitizationobjSet to the given field
which has to be of type Collection.
addAll in interface IFinitizationclassName - - name of the field's declaring class (class which contains the field)fieldName - - name of the fieldobjSet - - set of objects to be added to the given field (collection)IFinitization.addAll(String, IObjSet),
IFinitization.addAll(Class, String, IObjSet)
public void addAll(Class cls,
String fieldName,
IObjSet objSet)
IFinitizationobjSet to the given field
which has to be of type Collection.
addAll in interface IFinitizationcls - - field's declaring class (class which contains the field)fieldName - - name of the fieldobjSet - - set of objects to be added to the given field (collection)IFinitization.addAll(String, IObjSet),
IFinitization.addAll(String, String, IObjSet)public int[] getInitialCandidateVector()
public boolean includeFinitization(IFinitization ifin)
IFinitizationfin into current
finitization. Only one finitization of the same type can be included.
includeFinitization in interface IFinitizationifin - - finitization which will be included in current finitization
IFinitization.getIncludedFinitization(Class)public IFinitization getIncludedFinitization(Class clazz)
IFinitizationclazz parameter
getIncludedFinitization in interface IFinitizationclazz - - class for which the finitization has been done
IFinitization.includeFinitization(IFinitization)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||