|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.ksu.cis.projects.bogor.module.value.DefaultArrayValue
public class DefaultArrayValue
The default implementation of IArrayValue.
| Field Summary | |
|---|---|
protected IValueArray |
elementValues
Holds the element values of this array value. |
protected IValueArray |
fieldValues
Holds the field values of this array value. |
protected ILockValue |
lockValue
Holds the lock value of this array value. |
protected int |
referenceId
Holds the reference id of this array. |
protected ArrayType |
type
The array type of this array value. |
protected IValueFactory |
vf
Holds the value factory of this array value. |
| Constructor Summary | |
|---|---|
protected |
DefaultArrayValue()
Private constructor for cloning purposes. |
protected |
DefaultArrayValue(IValueFactory vf,
int referenceId,
ArrayType type,
IValueArray elementValues,
IValueArray fieldValues,
ILockValue lockValue)
Default constructor. |
| Method Summary | |
|---|---|
IArrayValue |
clone(Map<Object,Object> cloneMap)
Override to specialize return type. |
int |
compareTo(IValue o)
|
void |
dispose()
Remove references. |
boolean |
equals(Object o)
Classes implementing IValue should provide their own
equality tests. |
IValue |
getElementValue(int elementIndex)
Gets an array element's value. |
IValueArray |
getElementValues()
Gets the element values. |
int |
getFieldCount()
Gets the number of fields in this record. |
IValue |
getFieldValue(int fieldIndex)
Gets a record field's value. |
IValueArray |
getFieldValues()
|
int |
getLength()
Gets the length of this array. |
ILockValue |
getLockValue()
Gets the lock value of this record. |
int |
getReferenceId()
Gets this non-primitive value reference id. |
Type |
getType()
Gets the type of this value. |
int |
getTypeId()
Gets the type id of this value. |
int |
hashCode()
Classes implementing IValue should provide their own
hashing method. |
byte[][] |
linearize(int bitsPerNonPrimitiveValue,
ObjectIntTable<INonPrimitiveValue> nonPrimitiveValueIdMap,
int bitsPerThreadId,
IntIntTable threadOrderMap)
Linearizes this record value. |
void |
setElementValue(int elementIndex,
IValue elementValue)
Sets an array element's value. |
void |
setFieldValue(int fieldIndex,
IValue fieldValue)
Sets a record field's value. |
String |
toString()
Gets the string representation of this value. |
String |
toVerboseString()
Returns the verbose string representation of this array. |
void |
validate(IBogorConfiguration bc)
Freshen references to Bogor model checking components and other non-serializable objects. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected transient IValueFactory vf
protected IValueArray fieldValues
protected IValueArray elementValues
protected ILockValue lockValue
protected ArrayType type
protected int referenceId
| Constructor Detail |
|---|
protected DefaultArrayValue(IValueFactory vf,
int referenceId,
ArrayType type,
IValueArray elementValues,
IValueArray fieldValues,
ILockValue lockValue)
vf - The value factory of this array value. Must be non-null.referenceId - The reference id for this array value. Must be greater than 0.type - The array type for this array value. Must be non-null.elementValues - The element values for this array value. Must be non-null.fieldValues - The field values for this array value. Must be non-null.lockValue - The lock value for this array value. Must be non-null.SymbolTable.getArrayFieldIndex(String)protected DefaultArrayValue()
| Method Detail |
|---|
public void setElementValue(int elementIndex,
IValue elementValue)
IArrayValue
setElementValue in interface IArrayValueelementIndex - The index of the element in this array.
Must be greater than zero and less than the length of this array.elementValue - The new value of the element.
Must be non-null.public IValue getElementValue(int elementIndex)
IArrayValue
getElementValue in interface IArrayValueelementIndex - The index of the element in this array.
Must be greater than zero and less than the length of this array.
public IValueArray getElementValues()
IArrayValue
getElementValues in interface IArrayValuepublic int getFieldCount()
IRecordValue
getFieldCount in interface IRecordValue
public void setFieldValue(int fieldIndex,
IValue fieldValue)
IRecordValue
setFieldValue in interface IRecordValuefieldIndex - The index of the field in this record. Must be greater than
zero and less than the field count of this record.fieldValue - The new value of the field. Must be non-null.RecordType.getFieldIndex(String)public IValue getFieldValue(int fieldIndex)
IRecordValue
getFieldValue in interface IRecordValuefieldIndex - The index of the field in this record. Must be greater than
zero and less than the field count of this record.
RecordType.getFieldIndex(String)public IValueArray getFieldValues()
getFieldValues in interface IRecordValuepublic int getLength()
IArrayValue
getLength in interface IArrayValuepublic ILockValue getLockValue()
IRecordValue
getLockValue in interface IRecordValuepublic int getReferenceId()
INonPrimitiveValue
getReferenceId in interface INonPrimitiveValuepublic Type getType()
IValue
getType in interface IValueType.getTypeId()public int getTypeId()
IValue
getTypeId in interface IValueType.getTypeId()public IArrayValue clone(Map<Object,Object> cloneMap)
IArrayValue
clone in interface IArrayValueclone in interface INonPrimitiveValueclone in interface IRecordValueclone in interface IValuecloneMap - Original values (IValue) to their clones (
IValue) mapping. The clone map to solve
circular references in values. If this value is a key in the
map, then this method returns the value of the key in the map.
Must be non-null.
public int compareTo(IValue o)
compareTo in interface Comparable<IValue>public void dispose()
Disposable
dispose in interface Disposablepublic boolean equals(Object o)
IValueIValue should provide their own
equality tests.
equals in interface IValueequals in class Objectpublic int hashCode()
IValueIValue should provide their own
hashing method.
hashCode in interface IValuehashCode in class Object
public byte[][] linearize(int bitsPerNonPrimitiveValue,
ObjectIntTable<INonPrimitiveValue> nonPrimitiveValueIdMap,
int bitsPerThreadId,
IntIntTable threadOrderMap)
IRecordValue
linearize in interface IRecordValuebitsPerNonPrimitiveValue - The number of bits used to encode a non-primitive value.nonPrimitiveValueIdMap - A mapping of non-primitive values to their unique id. Must be
non-null.bitsPerThreadId - The number of bits used to encode a thread descriptor.threadOrderMap - A mapping of thread descriptors to their order number. Must be
non-null.
public String toString()
IValue
toString in interface IValuetoString in class Objectpublic String toVerboseString()
IArrayValue
toVerboseString in interface IArrayValuetoVerboseString in interface IRecordValuepublic void validate(IBogorConfiguration bc)
IValueFreshen references to Bogor model checking components and other non-serializable objects. Generally, this can be done in a few steps:
Model checking components (IModule implementations) should be
reacquired by fetching them from the parameter,
bc:
valueFactory = bc.getValueFactory();
scheduler = bc.getSchedulingStrategist();
Any fields storing Type objects should be treated as stale, but
still uniquely identifier by their integer typeId field. This
can be used as a key to look up the correct Type instances in the
new symbol table's typeId-to-type table:
typeField = bc.getSymbolTable().getTypeIdTypeTable().get(typeField.getTypeId());
Any IValueArray objects contained can simply be "chained" by
their IValueArray.validate(IBogorConfiguration) method:
someValueArray.validate(bc);
IValue objects contained directly should not be handled
manually by this method; they will be dealt with directly when they are visited
later
validate in interface IValuebc - The Bogor configuration to validate to.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||