edu.ksu.cis.projects.bogor.module.value
Class DefaultStringValue

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.module.value.DefaultStringValue
All Implemented Interfaces:
INonPrimitiveValue, IStringValue, IValue, Disposable, Serializable, Comparable<IValue>

public class DefaultStringValue
extends Object
implements IStringValue, Serializable

The default implementation of IStringValue.

Version:
CVS $Revision: 1.14 $ $Date: 2005/06/06 19:15:31 $
Author:
Robby , Matt Hoosier
See Also:
Serialized Form

Field Summary
protected  int referenceId
          Holds the reference id of this string value.
protected  String s
          Holds the string of this string value.
protected  StringType type
          Holds the type of this string value.
 
Constructor Summary
protected DefaultStringValue(int referenceId, StringType type, String s)
          Default constructor.
 
Method Summary
 IStringValue 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.
 int getReferenceId()
          Gets this non-primitive value reference id.
 String getString()
          Gets the string of this string value.
 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()
          Linearizes this string value.
 String toString()
          Gets the string representation of this value.
 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

s

protected String s
Holds the string of this string value.


type

protected StringType type
Holds the type of this string value.


referenceId

protected int referenceId
Holds the reference id of this string value. Must be greater than 0.

Constructor Detail

DefaultStringValue

protected DefaultStringValue(int referenceId,
                             StringType type,
                             String s)
Default constructor.

Parameters:
referenceId - The reference id for this string value.
type - The type for this string value. Must be non-null.
s - The string for this string value. Must be non-null.
Method Detail

getReferenceId

public int getReferenceId()
Description copied from interface: INonPrimitiveValue
Gets this non-primitive value reference id.

Specified by:
getReferenceId in interface INonPrimitiveValue
Returns:
This value reference id.

getString

public String getString()
Description copied from interface: IStringValue
Gets the string of this string value.

Specified by:
getString in interface IStringValue
Returns:
The string of this string value. Non-null.

getType

public Type getType()
Description copied from interface: IValue
Gets the type of this value.

Specified by:
getType in interface IValue
Returns:
The type of this value. Non-null.
See Also:
Type.getTypeId()

getTypeId

public int getTypeId()
Description copied from interface: IValue
Gets the type id of this value.

Specified by:
getTypeId in interface IValue
Returns:
The type id of this value.
See Also:
Type.getTypeId()

clone

public IStringValue clone(Map<Object,Object> cloneMap)
Description copied from interface: INonPrimitiveValue
Override to specialize return type

Specified by:
clone in interface INonPrimitiveValue
Specified by:
clone in interface IStringValue
Specified by:
clone in interface IValue
Parameters:
cloneMap - 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.
Returns:
The clone of this value. Non-null.

dispose

public void dispose()
Description copied from interface: Disposable
Remove references. Once called, avoid using this object.

Specified by:
dispose in interface Disposable

linearize

public byte[][] linearize()
Description copied from interface: IStringValue
Linearizes this string value.

Specified by:
linearize in interface IStringValue
Returns:
The bit-vectors representation of this string value. Non-null. Each element is non-null.

toString

public String toString()
Description copied from interface: IValue
Gets the string representation of this value.

Specified by:
toString in interface IValue
Overrides:
toString in class Object
Returns:
The string representation of this value. Non-null.

validate

public void validate(IBogorConfiguration bc)
Description copied from interface: IValue

Freshen 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

Specified by:
validate in interface IValue
Parameters:
bc - The Bogor configuration to validate to.

equals

public boolean equals(Object o)
Description copied from interface: IValue
Classes implementing IValue should provide their own equality tests.

Specified by:
equals in interface IValue
Overrides:
equals in class Object

hashCode

public int hashCode()
Description copied from interface: IValue
Classes implementing IValue should provide their own hashing method.

Specified by:
hashCode in interface IValue
Overrides:
hashCode in class Object

compareTo

public int compareTo(IValue o)
Specified by:
compareTo in interface Comparable<IValue>