|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkorat.finitization.impl.FieldDomain
korat.finitization.impl.ObjSet
public class ObjSet
Nested Class Summary | |
---|---|
(package private) static class |
ObjSet.CacheElement
|
Field Summary | |
---|---|
private List<ObjSet.CacheElement> |
cache
|
protected List<ClassDomain> |
domains
|
private boolean |
isCacheValid
|
private boolean |
nullAllowed
|
Fields inherited from class korat.finitization.impl.FieldDomain |
---|
classOfField |
Constructor Summary | |
---|---|
ObjSet(Class classOfField)
|
|
ObjSet(String classOfFieldName)
|
Method Summary | |
---|---|
boolean |
addClassDomain(IClassDomain domain)
Adds new class domain. |
Object[] |
getAllObjects()
Returns all objest in entire IObjSet .Those are all
objects that can be assigned to the field that this
IFieldDomain is assigned to. |
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. |
List<IClassDomain> |
getClassDomains()
Returns the list of all class domains |
int |
getIndexOfFirstObjectInNextClassDomain(int objectIndex)
|
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. |
Object |
getObject(int objectIndex)
Returns object with the given index in entire ObjSet . |
Object[] |
getObjectsOfClass(Class cls)
Returns instances (direct or indirect) of the given class in entire IObjSet |
Object[] |
getObjectsOfClass(int classDomainIndex)
Returns instances of the class domain with the given index in this ObjSet . |
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 |
isNullAllowed()
Is null allowed or not. |
boolean |
isPrimitiveType()
Does this field domain represent primitive type. |
boolean |
removeClassDomain(IClassDomain domain)
Removes class domain from this IObjSet |
ClassDomain |
removeClassDomain(int index)
Removes class domain from IObjSet |
void |
setNullAllowed(boolean allowed)
Sets whether null is allowed or not. |
private void |
updateCache()
|
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 |
---|
private List<ObjSet.CacheElement> cache
private boolean isCacheValid
protected List<ClassDomain> domains
private boolean nullAllowed
Constructor Detail |
---|
ObjSet(Class classOfField)
ObjSet(String classOfFieldName) throws ClassNotFoundException
ClassNotFoundException
Method Detail |
---|
private void updateCache()
public boolean addClassDomain(IClassDomain domain)
IObjSet
classOfObjects
of the given
IClassDomain
must be assignable to the
classOfField
of this IObjSet
.
addClassDomain
in interface IObjSet
domain
- Class domain
IllegalArgumentException
- -
if this field is not assignable from the given class domainIFieldDomain.getClassOfField()
,
IClassDomain.getClassOfObjects()
,
IFieldDomain
,
IClassDomain
public boolean removeClassDomain(IClassDomain domain)
IObjSet
IObjSet
removeClassDomain
in interface IObjSet
domain
- Class domain to be removed
true
if domain existed in this field
domainpublic ClassDomain removeClassDomain(int index)
IObjSet
IObjSet
removeClassDomain
in interface IObjSet
index
- index of class domain to be removed. If index is out of
bounds, should return null
instead of throwing
an exception
IObjSet.removeClassDomain(IClassDomain)
public List<IClassDomain> getClassDomains()
IObjSet
getClassDomains
in interface IObjSet
public ClassDomain getClassDomain(int classDomainIndex)
FieldDomain
null
.
getClassDomain
in class FieldDomain
classDomainIndex
- -
the index of the class domain
public ClassDomain getClassDomainFor(int objectIndex)
FieldDomain
getClassDomainFor(objectIndex)
and returns the following
class domain.
Primitive types should return null
.
getClassDomainFor
in class FieldDomain
objectIndex
- -
the index of the given object
public ClassDomain getNextClassDomainFor(int objectIndex)
FieldDomain
getClassDomainFor(objectIndex)
and returns the following
class domain.
Primitive typess should return null
.
getNextClassDomainFor
in class FieldDomain
objectIndex
- -
the index of the given object
public int getNumOfClassDomains()
FieldDomain
1
.
getNumOfClassDomains
in interface IFieldDomain
getNumOfClassDomains
in class FieldDomain
IPrimitiveTypeSet
public int getSizeOfClassDomain(int classDomainIndex)
FieldDomain
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.
getSizeOfClassDomain
in class FieldDomain
classDomainIndex
- -
class domain index
classDomainIndex
public int getNumberOfElements()
FieldDomain
getNumberOfElements
in interface IFieldDomain
getNumberOfElements
in class FieldDomain
public boolean isPrimitiveType()
IFieldDomain
isPrimitiveType
in interface IFieldDomain
true
for primitive data types and strings,
false
otherwisepublic boolean isArrayType()
IFieldDomain
isArrayType
in interface IFieldDomain
true
if class of this FieldDomain is array,
false
otherwisepublic Object[] getAllObjects()
IObjSet
IObjSet
.Those are all
objects that can be assigned to the field that this
IFieldDomain
is assigned to.
getAllObjects
in interface IObjSet
public Object[] getObjectsOfClass(Class cls)
IObjSet
IObjSet
getObjectsOfClass
in interface IObjSet
cls
- base class
IObjSet.getAllObjects()
public Object[] getObjectsOfClass(int classDomainIndex)
ObjSet
.
classDomainIndex
- index of the class domain within this field domain
getObjectsOfClass(Class)
,
getObject(int)
,
getAllObjects()
public Object getObject(int objectIndex)
ObjSet
.
objectIndex
- -
zero based index of the object in this field domain
isNullAllowed
evaluates to
true
, the zero-index object in the
ObjSet
is always null
. Also
returns null
if index is out of bounds.getAllObjects()
,
getObjectsOfClass(Class)
,
getObjectsOfClass(int)
public void setNullAllowed(boolean allowed)
IObjSet
null
is allowed or not. By default
null
is not allowed.
setNullAllowed
in interface IObjSet
allowed
- whether null
value is allowed.IObjSet.isNullAllowed()
public boolean isNullAllowed()
IObjSet
isNullAllowed
in interface IObjSet
IObjSet.isNullAllowed()
public int getIndexOfFirstObjectInNextClassDomain(int objectIndex)
getIndexOfFirstObjectInNextClassDomain
in class FieldDomain
public int getClassDomainIndexFor(int objectIndex)
FieldDomain
objectIndex
because primitive type field domains
conceptually contain exactly one class domain.
getClassDomainIndexFor
in class FieldDomain
objectIndex
- -
index of object in the field domain
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |