edu.ksu.cis.projects.bogor.module
Interface IValueFactory

All Superinterfaces:
Disposable, IEventProvider, IModule, IValueEventProvider
All Known Implementing Classes:
DefaultValueFactory

public interface IValueFactory
extends IModule, IValueEventProvider

A value factory interface.

Version:
CVS $Revision: 1.6 $ $Date: 2004/09/05 01:25:16 $
Author:
Robby

Method Summary
 IValue createDefaultValue(Type type)
          Creates a default value of a type.
 int getReferenceIdSeed()
          Gets the reference id seed.
 Type getType(IValue value)
          Gets the type of a value.
 IArrayValue newArrayValue(ArrayType arrayType, Type[] fieldTypes, int[] lengths)
          Creates an array value.
 IDoubleValue newDoubleValue(double d)
          Creates a double value.
 IExpASTValue newExpASTValue(Exp exp)
          Creates an exp AST value.
 IFloatValue newFloatValue(float f)
          Creates a float value.
 IIntValue newIntValue(int integer)
          Creates an integer value.
 IIntValue newIntValue(Type type, int integer)
          Creates an integer value.
 ILockValue newLockValue()
          Creates a new lock value.
 ILongValue newLongValue(long l)
          Creates a long value.
 ILongValue newLongValue(LongType type, long l)
          Creates an integer value.
 INullValue newNullValue()
          Creates a new null value.
 IRecordValue newRecordValue(RecordType recordType)
          Creates a new record value.
 int newReferenceId()
          Generates a new reference id.
 IStringValue newStringValue(String s)
          Creates a string value.
 IValueArray newUniformValueArray(IValue[] values)
          Creates a value array from an array of values.
 IValueArray newVariedValueArray(IValue[] values)
          Creates a value array from an array of values.
 void setReferenceIdSeed(int newSeed)
          Sets the reference id seed.
 void validate(IValue value)
          Validates a value.
 void validate(IValueArray valueArray)
          Validates a value array.
 
Methods inherited from interface edu.ksu.cis.projects.bogor.module.IModule
connect, getCopyrightNotice, setOptions
 
Methods inherited from interface edu.ksu.cis.projects.bogor.util.Disposable
dispose
 
Methods inherited from interface edu.ksu.cis.projects.bogor.module.value.event.IValueEventProvider
getNotifier, getNotifier
 
Methods inherited from interface edu.ksu.cis.projects.bogor.module.event.IEventProvider
backward, forward, getState, getThreadId, isBackward, isForward, removeContext, setContext
 

Method Detail

newReferenceId

int newReferenceId()
Generates a new reference id.

Returns:
A new reference id.

getReferenceIdSeed

int getReferenceIdSeed()
Gets the reference id seed.

Returns:
The reference id seed.

setReferenceIdSeed

void setReferenceIdSeed(int newSeed)
Sets the reference id seed.

Parameters:
newSeed - The new seed.

getType

Type getType(IValue value)
Gets the type of a value.

Parameters:
value - The value whose type to be retrieved. Must be non-null.
Returns:
The type of the value. Non-null.

createDefaultValue

IValue createDefaultValue(Type type)
Creates a default value of a type.

Parameters:
type - The type whose default value to be created. If the type is a range type that does not include zero in its range, then the low limit of the range type is the default value. Must be either a primitive type or a non-primitive type.
Returns:
The default value of the type. Non-null.

newArrayValue

IArrayValue newArrayValue(ArrayType arrayType,
                          Type[] fieldTypes,
                          int[] lengths)
Creates an array value.

Parameters:
arrayType - The array type whose value to be created.
fieldTypes - The array fields' types. Must be non-null. Each element must be non-null.
lengths - The lengths of dimensions of the new array. The number of lenghts must be at most equal to the array rank. Must contain at least one element. Each length must be at least zero.
Returns:
A new array value. Non-null. The array's elements and fields are assigned to their default values.

newDoubleValue

IDoubleValue newDoubleValue(double d)
Creates a double value.

Parameters:
d - The double of the double value.
Returns:
A new double value. Non-null.

newExpASTValue

IExpASTValue newExpASTValue(Exp exp)
Creates an exp AST value.

Parameters:
exp - The exp AST of the exp AST value. Must be non-null.
Returns:
A new exp AST value. Non-null.

newFloatValue

IFloatValue newFloatValue(float f)
Creates a float value.

Parameters:
f - The float of the float value.
Returns:
A new float value. Non-null.

newIntValue

IIntValue newIntValue(Type type,
                      int integer)
Creates an integer value.

Parameters:
type - The type of this integer. Must be instance of IntType or BooleanType.
integer - The integer of this integer value.
Returns:
A new integer value whose type is given. Non-null.

newIntValue

IIntValue newIntValue(int integer)
Creates an integer value.

Parameters:
integer - The integer of the integer value.
Returns:
A new integer value with IntType as its type. Non-null.

newLockValue

ILockValue newLockValue()
Creates a new lock value.

Returns:
A new lock value. Non-null.

newLongValue

ILongValue newLongValue(LongType type,
                        long l)
Creates an integer value.

Parameters:
type - The type of the long value. Must be non-null.
l - The long of the long value.
Returns:
A new integer value whose type is given. Non-null.

newLongValue

ILongValue newLongValue(long l)
Creates a long value.

Parameters:
l - The long of the long value.
Returns:
A new long value with LongType as its type. Non-null.

newNullValue

INullValue newNullValue()
Creates a new null value.

Returns:
A new null value. Non-null.

newRecordValue

IRecordValue newRecordValue(RecordType recordType)
Creates a new record value.

Parameters:
recordType - The record type whose value to be created. Must be non-null.
Returns:
A new record value. Non-null. The record's fields are assigned to their default values.

newStringValue

IStringValue newStringValue(String s)
Creates a string value.

Parameters:
s - The string of the string value. Must be non-null.
Returns:
A new string value. Non-null.

newVariedValueArray

IValueArray newVariedValueArray(IValue[] values)
Creates a value array from an array of values.

Parameters:
values - The array of values. Must be non-null. Each element must be non-null.
Returns:
The new value array.

newUniformValueArray

IValueArray newUniformValueArray(IValue[] values)
Creates a value array from an array of values.

Parameters:
values - The array of values. Must be non-null. Each element must be non-null. Each element must be of the same type.
Returns:
The new value array.

validate

void validate(IValue value)
Validates a value.

Parameters:
value - The value to be validated. Must be non-null.

validate

void validate(IValueArray valueArray)
Validates a value array.

Parameters:
valueArray - The value array to be validated. Must be non-null.