|
||||||||||
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 IFinitization
public void handleArraysAsObjects(boolean handleAsObjects)
IFinitization
If 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 IFinitization
handleAsObjects
- - should arrays be treated like objects during search.IFinitization.areArraysHandledAsObjects()
public Class getFinClass()
IFinitization
Class
object of the finitized class
getFinClass
in interface IFinitization
Class
object for root class that is being finitizedpublic IClassDomain createClassDomain(String className, int numOfInstances)
IFinitization
Class
object for the given
className
and then calls
createClassDomain(Class, int)
.
createClassDomain
in interface IFinitization
className
- fully qualified name of the class or relative to the package
name of the finitized class.numOfInstances
- number of elements to be created
IClassDomain
IFinitization.createClassDomain(Class, int)
public IClassDomain createClassDomain(Class cls, int numOfInstances)
IFinitization
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
createClassDomain
in interface IFinitization
cls
- Class
of the objectsnumOfInstances
- number of instances to be created
IClassDomain
IFinitization.createClassDomain(String, int)
public IBooleanSet createBooleanSet()
IFinitization
IBooleanSet
createBooleanSet
in interface IFinitization
IBooleanSet
public IIntSet createIntSet(int min, int diff, int max)
IFinitization
IIntSet
according to the given parameters.
createIntSet
in interface IFinitization
min
- minimal element of this set of integers (included)diff
- step, the difference between to elementsmax
- maximal element of this set of integers (included)
IIntSet
IFinitization.createIntSet(int)
,
IFinitization.createIntSet(int, int)
public IIntSet createIntSet(int min, int max)
IFinitization
IIntSet
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 IFinitization
min
- minimal element of this set of integers (included)max
- maximal element of this set of integers (included)
IIntSet
IFinitization.createIntSet(int)
,
IFinitization.createIntSet(int, int, int)
public IIntSet createIntSet(int singleValue)
IFinitization
IIntSet
with the single value that is given as the
method parameter. Equivalent of
createIntSet(value, 1, value)
.
createIntSet
in interface IFinitization
singleValue
- single value that will be added to IIntSet
IIntSet
IFinitization.createIntSet(int, int)
,
IFinitization.createIntSet(int, int, int)
public IByteSet createByteSet(byte min, byte diff, byte max)
createByteSet
in interface IFinitization
min
- - 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 IFinitization
min
- - minimum value to be included in the setmax
- - maximum value to be included in the set
IByteSet
public IByteSet createByteSet(byte singleValue)
IFinitization
IByteSet
with the single value that is given as
the method parameter. Equivalent of
createByteSet(value, 1, value)
.
createByteSet
in interface IFinitization
singleValue
- single value that will be added to IByteSet
IByteSet
IFinitization.createByteSet(byte, byte)
,
IFinitization.createByteSet(byte, byte, byte)
public IDoubleSet createDoubleSet(double min, double diff, double max)
createDoubleSet
in interface IFinitization
min
- - 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 IFinitization
min
- - minimum value to be included in the setmax
- - maximum value to be included in the set
IDoubleSet
public IDoubleSet createDoubleSet(double singleValue)
IFinitization
IDoubleSet
with the single value that is given as
the method parameter. Equivalent of
createDoubleSet(value, 1, value)
.
createDoubleSet
in interface IFinitization
singleValue
- single value that will be added to IDoubleSet
IDoubletSet
IFinitization.createDoubleSet(double, double)
,
IFinitization.createDoubleSet(double, double, double)
public IFloatSet createFloatSet(float min, float diff, float max)
IFinitization
createFloatSet
in interface IFinitization
min
- - 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 IFinitization
min
- - minimum value to be included in the setmax
- - maximum value to be included in the set
IFloatSet
public IFloatSet createFloatSet(float singleValue)
IFinitization
IFloatSet
with the single value that is given as
the method parameter. Equivalent of
createFloatSet(value, 1, value)
.
createFloatSet
in interface IFinitization
singleValue
- single value that will be added to IFloatSet
IFloatSet
IFinitization.createFloatSet(float, float)
,
IFinitization.createFloatSet(float, float, float)
public ILongSet createLongSet(long min, long diff, long max)
createLongSet
in interface IFinitization
min
- - 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 IFinitization
min
- - minimum value to be included in the setmax
- - maximum value to be included in the set
ILongSet
public ILongSet createLongSet(long singleValue)
IFinitization
ILongSet
with the single value that is given as
the method parameter. Equivalent of
createLongSet(value, 1, value)
.
createLongSet
in interface IFinitization
singleValue
- single value that will be added to ILongSet
ILongSet
IFinitization.createLongSet(long, long)
,
IFinitization.createLongSet(long, long, long)
public IShortSet createShortSet(short min, short diff, short max)
createShortSet
in interface IFinitization
min
- - 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 IFinitization
min
- - minimum value to be included in the setmax
- - maximum value to be included in the set
IShortSet
public IShortSet createShortSet(short singleValue)
IFinitization
IShortSet
with the single value that is given as
the method parameter. Equivalent of
createShortSet(value, 1, value)
.
createShortSet
in interface IFinitization
singleValue
- single value that will be added to IShortSet
IShortSet
IFinitization.createShortSet(short, short)
,
IFinitization.createShortSet(short, short, short)
public IObjSet createObjSet(Class fieldBaseClass, boolean includeNull)
IFinitization
IObjSet
according to the given parameters.
createObjSet
in interface IFinitization
fieldBaseClass
- 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
.
IObjSet
IFinitization.createObjSet(Class)
,
IFinitization.createObjSet(String)
,
IFinitization.createObjSet(String, boolean)
public IObjSet createObjSet(Class fieldBaseClass)
IFinitization
createObjSet(fieldBaseClass, false);
createObjSet
in interface IFinitization
fieldBaseClass
- Base type of the field
IObjSet
IFinitization.createObjSet(Class, boolean)
,
IFinitization.createObjSet(String)
,
IFinitization.createObjSet(String, boolean)
public IObjSet createObjSet(String fieldBaseClassName, boolean includeNull)
IFinitization
Class
object for the given
fieldBaseClassName
and then calls
createObjSet(Class, boolean)
.
createObjSet
in interface IFinitization
fieldBaseClassName
- name of the base type of the fieldincludeNull
- weather to include null in the IObjSet
.
IObjSet
IFinitization.createObjSet(Class, boolean)
,
IFinitization.createObjSet(Class)
,
IFinitization.createObjSet(String)
public IObjSet createObjSet(String fieldBaseClassName)
IFinitization
createFieldDomain(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)
IFinitization
classDomain
and adds classDomain
. Null value is not allowed
createObjSet
in interface IFinitization
IFieldDomain
public IFieldDomain createObjSet(IClassDomain classDomain, boolean includeNull)
IFinitization
createObjSet(IClassDomain classDomain)
but also can include null value
createObjSet
in interface IFinitization
IFieldDomain
IFinitization.createObjSet(IClassDomain)
public void set(Class cls, String fieldName, IFieldDomain fieldDomain)
IFinitization
fieldDomain
to the given field (fieldName
)
of the given class (cls
).createObjSet(cls, numOfInstances)
)
set
in interface IFinitization
cls
- -
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)
IFinitization
set(Class, String, IFieldDomain)
set
in interface IFinitization
className
- -
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)
IFinitization
fullFieldName
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 IFinitization
fullFieldName
- -
name of the field ( format: ClassName.FieldName )fieldDomain
- -
field domainIFinitization.set(Class, String, IFieldDomain)
,
IFinitization.set(String, String, IFieldDomain)
public ClassDomain getClassDomain(Class cls)
IFinitization
ObjSet
of the given Class
object.
getClassDomain
in interface IFinitization
cls
- -
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)
IFinitization
Class
object of the class
with the given name and then calls getObjSet(Class)
getClassDomain
in interface IFinitization
name
- -
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 IFinitization
IFieldDomain
IFinitization.getFieldDomain(String)
,
IFinitization.getFieldDomain(String, String)
public IFieldDomain getFieldDomain(String className, String fieldName)
getFieldDomain
in interface IFinitization
IFieldDomain
IFinitization.getFieldDomain(Class, String)
,
IFinitization.getFieldDomain(String)
public IFieldDomain getFieldDomain(String fullFieldName)
getFieldDomain
in interface IFinitization
IFieldDomain
IFinitization.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)
IFinitization
Creates 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 IFinitization
clz
- 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)
IFinitization
createClassDomain(className)
createClassDomain
in interface IFinitization
IClassDomain
IFinitization.createClassDomain(String, int)
public IClassDomain createClassDomain(Class cls)
IFinitization
Equivalent to createClassDomain(cls, 0);
createClassDomain
in interface IFinitization
cls
- Class of the object
IFinitization.createClassDomain(Class, int)
public IObjSet createObjSet(Class fieldBaseClass, int numOfInstances, boolean includeNull)
IFinitization
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;
createObjSet
in interface IFinitization
fieldBaseClass
- -
class of the fieldnumOfInstances
- -
instances of the fieldBaseClass
that are to be
created in the class domain of fieldBaseClass
includeNull
- -
whether to include null in the IObjSet
IObjSet
public IObjSet createObjSet(Class fieldBaseClass, int numOfInstances)
IFinitization
Class
object for the given
fieldBaseClassName
and then calls
createObjSet(Class, int, boolean)
.
createObjSet
in interface IFinitization
IObjSet
public IObjSet createObjSet(String fieldBaseClassName, int numOfInstances, boolean includeNull)
IFinitization
Class
object for the given
fieldBaseClassName
and then calls
createObjSet(Class, int, boolean)
.
createObjSet
in interface IFinitization
IObjSet
public IObjSet createObjSet(String fieldBaseClassName, int numOfInstances)
IFinitization
createObjSet(fieldBaseClassName, numOfInstances, false);
- Specified by:
createObjSet
in interface IFinitization
- Returns:
- newly created
IObjSet
public void addAll(String fullFieldName, IObjSet objSet)
IFinitization
objSet
to the given field
which has to be of type Collection
.
addAll
in interface IFinitization
fullFieldName
- - 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)
IFinitization
objSet
to the given field
which has to be of type Collection
.
addAll
in interface IFinitization
className
- - 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)
IFinitization
objSet
to the given field
which has to be of type Collection
.
addAll
in interface IFinitization
cls
- - 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)
IFinitization
fin
into current
finitization. Only one finitization of the same type can be included.
includeFinitization
in interface IFinitization
ifin
- - finitization which will be included in current finitization
IFinitization.getIncludedFinitization(Class)
public IFinitization getIncludedFinitization(Class clazz)
IFinitization
clazz
parameter
getIncludedFinitization
in interface IFinitization
clazz
- - 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 |