edu.ksu.cis.projects.bogor.module
Class DefaultExpEvaluator
java.lang.Object
edu.ksu.cis.projects.bogor.module.DefaultExpEvaluator
- All Implemented Interfaces:
- ISelfDescribingModule, IExpEvaluator, IModule, Disposable
public class DefaultExpEvaluator
- extends Object
- implements IExpEvaluator, ISelfDescribingModule
- Version:
- CVS $Revision: 1.27 $ $Date: 2005/05/26 18:23:13 $
- Author:
- Robby , Matt Hoosier
Method Summary |
protected IValue |
checkRange(Type type,
IValue value)
|
IMessageStore |
connect(IBogorConfiguration bc)
Connects this modules to other modules. |
protected IValue |
convert(Object o)
|
void |
dispose()
Remove references. |
protected IValue |
evaluate(Exp exp)
|
IValue |
evaluate(ISchedulingStrategyContext ssc,
Exp exp,
ISchedulingStrategyInfo ssi)
|
IValue |
evaluateApply(String id,
IValue[] args)
|
protected IValue |
evaluateApplyExp(ApplyExp e)
|
IValue |
evaluateArrayAccess(IArrayValue arrayValue,
IIntValue indexValue)
|
protected IValue |
evaluateArrayAccessExp(ArrayAccessExp e)
|
protected IValue |
evaluateBinaryExp(BinaryExp e)
|
IValue |
evaluateBinaryOp(BinaryOp binop,
IDoubleValue value1,
IDoubleValue value2)
|
IValue |
evaluateBinaryOp(BinaryOp binop,
IFloatValue value1,
IFloatValue value2)
|
IValue |
evaluateBinaryOp(BinaryOp binop,
IIntValue value1,
IIntValue value2)
|
IValue |
evaluateBinaryOp(BinaryOp binop,
ILongValue value1,
ILongValue value2)
|
IValue |
evaluateBinaryOp(BinaryOp binop,
INonPrimitiveValue value1,
INonPrimitiveValue value2)
|
IValue |
evaluateBinaryOp(BinaryOp binop,
IPrimitiveExtValue value1,
IPrimitiveExtValue value2)
|
IValue |
evaluateBinaryOp(BinaryOp binop,
IValue value1,
IValue value2)
|
IArrayValue |
evaluateCast(ArrayType castType,
IArrayValue value)
|
IIntValue |
evaluateCast(IntType castType,
IDoubleValue value)
|
IIntValue |
evaluateCast(IntType castType,
IFloatValue value)
|
IIntValue |
evaluateCast(IntType castType,
IIntValue value)
|
IIntValue |
evaluateCast(IntType castType,
ILongValue value)
|
ILongValue |
evaluateCast(LongType castType,
IDoubleValue value)
|
ILongValue |
evaluateCast(LongType castType,
IFloatValue value)
|
ILongValue |
evaluateCast(LongType castType,
IIntValue value)
|
ILongValue |
evaluateCast(LongType castType,
ILongValue value)
|
IRecordValue |
evaluateCast(RecordType castType,
IRecordValue value)
|
IValue |
evaluateCast(Type castType,
Type valueType,
IValue value)
|
IDoubleValue |
evaluateCastDouble(IFloatValue value)
|
IDoubleValue |
evaluateCastDouble(IIntValue value)
|
IDoubleValue |
evaluateCastDouble(ILongValue value)
|
protected IValue |
evaluateCastExp(CastExp e)
|
IFloatValue |
evaluateCastFloat(IDoubleValue value)
|
IFloatValue |
evaluateCastFloat(IIntValue value)
|
IFloatValue |
evaluateCastFloat(ILongValue value)
|
protected IValue |
evaluateConditionalExp(ConditionalExp e)
|
IValue |
evaluateExt(String expExtId,
Node node,
Type[] typeVarArgs,
IValue[] args)
|
protected IValue |
evaluateExtExp(ExtExp e)
|
IValue |
evaluateFieldAccess(IRecordValue value,
int fieldIndex)
|
protected IValue |
evaluateFieldAccessExp(FieldAccessExp e)
|
protected IValue |
evaluateIdExp(IdExp e)
|
IIntValue |
evaluateInstanceof(IValue value,
Type instanceofType)
|
protected IValue |
evaluateInstanceofExp(InstanceofExp e)
|
IIntValue |
evaluateKindof(IValue value,
Type kindofType)
|
protected IValue |
evaluateKindofExp(KindofExp e)
|
protected IValue |
evaluateLetExp(LetExp e)
|
protected IValue |
evaluateLiteral(Literal l)
|
protected IValue |
evaluateLiteralExp(LiteralExp e)
|
protected IValue |
evaluateLockTestExp(LockTestExp e)
|
IValue |
evaluateLockTestOp(int threadId,
LockTestOp locktestop,
IValue value)
|
IArrayValue |
evaluateNewArray(ArrayType arrayType,
IValue[] lengths)
|
protected IValue |
evaluateNewArrayExp(NewArrayExp e)
|
ILockValue |
evaluateNewLock()
|
IRecordValue |
evaluateNewRecord(RecordType recordType)
|
protected IValue |
evaluateNewRecordExp(NewRecordExp e)
|
protected IValue |
evaluateThreadTestExp(ThreadTestExp e)
|
protected IValue |
evaluateUnaryExp(UnaryExp e)
|
IDoubleValue |
evaluateUnaryOp(UnaryOp unop,
IDoubleValue value)
|
IFloatValue |
evaluateUnaryOp(UnaryOp unop,
IFloatValue value)
|
IIntValue |
evaluateUnaryOp(UnaryOp unop,
IIntValue value)
|
ILongValue |
evaluateUnaryOp(UnaryOp unop,
ILongValue value)
|
IValue |
evaluateUnaryOp(UnaryOp unop,
IValue value)
|
String |
getCopyrightNotice()
Returns the copyright notice for this module. |
protected FSMSymbolTable |
getFSMSymbolTable()
|
Pair<Domain,Boolean> |
getOptionDomain(String id)
|
Collection<Triple<String,Boolean,OptionScope>> |
getOptionIds()
|
Collection<String> |
getSuggestedValues(String id,
IBogorConfiguration bc,
SymbolTable st)
|
IMessageStore |
setOptions(String key,
Properties configuration)
Sets the options for this module. |
void |
setReadFieldsTable(Map<IRecordValue,IntSet> readFieldsTable)
|
void |
setReadGlobalSet(IntSet readGlobals)
|
void |
setReadValueSet(Set<IValue> readValues)
|
Pair<ISchedulingStrategyContext,ISchedulingStrategyInfo> |
setSchedulingStrategyContextInfo(ISchedulingStrategyContext ssc,
ISchedulingStrategyInfo ssi)
|
Pair<ISchedulingStrategyContext,ISchedulingStrategyInfo> |
unsetSchedulingStrategyContextInfo()
|
boolean |
validate(String id,
String value,
IBogorConfiguration bc,
SymbolTable st,
Collection<FileMessage> errors)
Checks whether the value of a configuration option is legal. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ee
protected IExpEvaluator ee
ssc
protected ISchedulingStrategyContext ssc
ssi
protected ISchedulingStrategyInfo ssi
ss
protected ISchedulingStrategist ss
vf
protected IValueFactory vf
symbolTable
protected SymbolTable symbolTable
extTable
protected Map<ExtSymbolTable,IModule> extTable
arrayFieldTypes
protected Type[] arrayFieldTypes
readGlobals
protected IntSet readGlobals
readValues
protected Set<IValue> readValues
readFieldsTable
protected Map<IRecordValue,IntSet> readFieldsTable
bindingMap
protected HashMap<String,IValue> bindingMap
DefaultExpEvaluator
public DefaultExpEvaluator()
getCopyrightNotice
public String getCopyrightNotice()
- Description copied from interface:
IModule
- Returns the copyright notice for this module.
- Specified by:
getCopyrightNotice
in interface IModule
- Returns:
- The copyright notice for this module.
Returns null if no additional notice is necessary.
setOptions
public IMessageStore setOptions(String key,
Properties configuration)
- Description copied from interface:
IModule
- Sets the options for this module.
- Specified by:
setOptions
in interface IModule
- Parameters:
key
- The key (prefix) for this module options. Must be non-null.
The key is used for module specific options.configuration
- The options for all modules. Must be non-null.
setReadFieldsTable
public void setReadFieldsTable(Map<IRecordValue,IntSet> readFieldsTable)
- Specified by:
setReadFieldsTable
in interface IExpEvaluator
setReadGlobalSet
public void setReadGlobalSet(IntSet readGlobals)
- Specified by:
setReadGlobalSet
in interface IExpEvaluator
setReadValueSet
public void setReadValueSet(Set<IValue> readValues)
- Specified by:
setReadValueSet
in interface IExpEvaluator
setSchedulingStrategyContextInfo
public Pair<ISchedulingStrategyContext,ISchedulingStrategyInfo> setSchedulingStrategyContextInfo(ISchedulingStrategyContext ssc,
ISchedulingStrategyInfo ssi)
- Specified by:
setSchedulingStrategyContextInfo
in interface IExpEvaluator
- Returns:
- the previous scheduling context info objects (if any)
connect
public IMessageStore connect(IBogorConfiguration bc)
- Description copied from interface:
IModule
- Connects this modules to other modules.
- Specified by:
connect
in interface IModule
- Parameters:
bc
- The Bogor configuration containing modules to connect to.
Must be 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
evaluate
public IValue evaluate(ISchedulingStrategyContext ssc,
Exp exp,
ISchedulingStrategyInfo ssi)
- Specified by:
evaluate
in interface IExpEvaluator
evaluateApply
public IValue evaluateApply(String id,
IValue[] args)
- Specified by:
evaluateApply
in interface IExpEvaluator
evaluateArrayAccess
public IValue evaluateArrayAccess(IArrayValue arrayValue,
IIntValue indexValue)
- Specified by:
evaluateArrayAccess
in interface IExpEvaluator
evaluateBinaryOp
public IValue evaluateBinaryOp(BinaryOp binop,
IValue value1,
IValue value2)
- Specified by:
evaluateBinaryOp
in interface IExpEvaluator
evaluateBinaryOp
public IValue evaluateBinaryOp(BinaryOp binop,
INonPrimitiveValue value1,
INonPrimitiveValue value2)
- Specified by:
evaluateBinaryOp
in interface IExpEvaluator
evaluateBinaryOp
public IValue evaluateBinaryOp(BinaryOp binop,
IPrimitiveExtValue value1,
IPrimitiveExtValue value2)
- Specified by:
evaluateBinaryOp
in interface IExpEvaluator
evaluateBinaryOp
public IValue evaluateBinaryOp(BinaryOp binop,
IIntValue value1,
IIntValue value2)
- Specified by:
evaluateBinaryOp
in interface IExpEvaluator
evaluateBinaryOp
public IValue evaluateBinaryOp(BinaryOp binop,
ILongValue value1,
ILongValue value2)
- Specified by:
evaluateBinaryOp
in interface IExpEvaluator
evaluateBinaryOp
public IValue evaluateBinaryOp(BinaryOp binop,
IFloatValue value1,
IFloatValue value2)
- Specified by:
evaluateBinaryOp
in interface IExpEvaluator
evaluateBinaryOp
public IValue evaluateBinaryOp(BinaryOp binop,
IDoubleValue value1,
IDoubleValue value2)
- Specified by:
evaluateBinaryOp
in interface IExpEvaluator
evaluateCast
public IValue evaluateCast(Type castType,
Type valueType,
IValue value)
- Specified by:
evaluateCast
in interface IExpEvaluator
evaluateCast
public IIntValue evaluateCast(IntType castType,
IIntValue value)
- Specified by:
evaluateCast
in interface IExpEvaluator
evaluateCast
public ILongValue evaluateCast(LongType castType,
ILongValue value)
- Specified by:
evaluateCast
in interface IExpEvaluator
evaluateCast
public ILongValue evaluateCast(LongType castType,
IIntValue value)
- Specified by:
evaluateCast
in interface IExpEvaluator
evaluateCast
public IIntValue evaluateCast(IntType castType,
ILongValue value)
- Specified by:
evaluateCast
in interface IExpEvaluator
evaluateCast
public IIntValue evaluateCast(IntType castType,
IFloatValue value)
- Specified by:
evaluateCast
in interface IExpEvaluator
evaluateCast
public IIntValue evaluateCast(IntType castType,
IDoubleValue value)
- Specified by:
evaluateCast
in interface IExpEvaluator
evaluateCast
public ILongValue evaluateCast(LongType castType,
IFloatValue value)
- Specified by:
evaluateCast
in interface IExpEvaluator
evaluateCast
public ILongValue evaluateCast(LongType castType,
IDoubleValue value)
- Specified by:
evaluateCast
in interface IExpEvaluator
evaluateCast
public IRecordValue evaluateCast(RecordType castType,
IRecordValue value)
- Specified by:
evaluateCast
in interface IExpEvaluator
evaluateCast
public IArrayValue evaluateCast(ArrayType castType,
IArrayValue value)
- Specified by:
evaluateCast
in interface IExpEvaluator
evaluateCastDouble
public IDoubleValue evaluateCastDouble(IIntValue value)
- Specified by:
evaluateCastDouble
in interface IExpEvaluator
evaluateCastDouble
public IDoubleValue evaluateCastDouble(ILongValue value)
- Specified by:
evaluateCastDouble
in interface IExpEvaluator
evaluateCastDouble
public IDoubleValue evaluateCastDouble(IFloatValue value)
- Specified by:
evaluateCastDouble
in interface IExpEvaluator
evaluateCastFloat
public IFloatValue evaluateCastFloat(IIntValue value)
- Specified by:
evaluateCastFloat
in interface IExpEvaluator
evaluateCastFloat
public IFloatValue evaluateCastFloat(ILongValue value)
- Specified by:
evaluateCastFloat
in interface IExpEvaluator
evaluateCastFloat
public IFloatValue evaluateCastFloat(IDoubleValue value)
- Specified by:
evaluateCastFloat
in interface IExpEvaluator
evaluateExt
public IValue evaluateExt(String expExtId,
Node node,
Type[] typeVarArgs,
IValue[] args)
- Specified by:
evaluateExt
in interface IExpEvaluator
evaluateFieldAccess
public IValue evaluateFieldAccess(IRecordValue value,
int fieldIndex)
- Specified by:
evaluateFieldAccess
in interface IExpEvaluator
evaluateInstanceof
public IIntValue evaluateInstanceof(IValue value,
Type instanceofType)
- Specified by:
evaluateInstanceof
in interface IExpEvaluator
evaluateKindof
public IIntValue evaluateKindof(IValue value,
Type kindofType)
- Specified by:
evaluateKindof
in interface IExpEvaluator
evaluateLockTestOp
public IValue evaluateLockTestOp(int threadId,
LockTestOp locktestop,
IValue value)
- Specified by:
evaluateLockTestOp
in interface IExpEvaluator
evaluateNewArray
public IArrayValue evaluateNewArray(ArrayType arrayType,
IValue[] lengths)
- Specified by:
evaluateNewArray
in interface IExpEvaluator
evaluateNewLock
public ILockValue evaluateNewLock()
- Specified by:
evaluateNewLock
in interface IExpEvaluator
evaluateNewRecord
public IRecordValue evaluateNewRecord(RecordType recordType)
- Specified by:
evaluateNewRecord
in interface IExpEvaluator
evaluateUnaryOp
public IValue evaluateUnaryOp(UnaryOp unop,
IValue value)
- Specified by:
evaluateUnaryOp
in interface IExpEvaluator
evaluateUnaryOp
public IIntValue evaluateUnaryOp(UnaryOp unop,
IIntValue value)
- Specified by:
evaluateUnaryOp
in interface IExpEvaluator
evaluateUnaryOp
public ILongValue evaluateUnaryOp(UnaryOp unop,
ILongValue value)
- Specified by:
evaluateUnaryOp
in interface IExpEvaluator
evaluateUnaryOp
public IFloatValue evaluateUnaryOp(UnaryOp unop,
IFloatValue value)
- Specified by:
evaluateUnaryOp
in interface IExpEvaluator
evaluateUnaryOp
public IDoubleValue evaluateUnaryOp(UnaryOp unop,
IDoubleValue value)
- Specified by:
evaluateUnaryOp
in interface IExpEvaluator
unsetSchedulingStrategyContextInfo
public Pair<ISchedulingStrategyContext,ISchedulingStrategyInfo> unsetSchedulingStrategyContextInfo()
- Specified by:
unsetSchedulingStrategyContextInfo
in interface IExpEvaluator
- Returns:
- the scheduling context info objects prior to unsetting (if any)
getFSMSymbolTable
protected FSMSymbolTable getFSMSymbolTable()
checkRange
protected IValue checkRange(Type type,
IValue value)
convert
protected IValue convert(Object o)
evaluate
protected IValue evaluate(Exp exp)
evaluateApplyExp
protected IValue evaluateApplyExp(ApplyExp e)
evaluateArrayAccessExp
protected IValue evaluateArrayAccessExp(ArrayAccessExp e)
evaluateBinaryExp
protected IValue evaluateBinaryExp(BinaryExp e)
evaluateCastExp
protected IValue evaluateCastExp(CastExp e)
evaluateConditionalExp
protected IValue evaluateConditionalExp(ConditionalExp e)
evaluateExtExp
protected IValue evaluateExtExp(ExtExp e)
evaluateFieldAccessExp
protected IValue evaluateFieldAccessExp(FieldAccessExp e)
evaluateIdExp
protected IValue evaluateIdExp(IdExp e)
evaluateInstanceofExp
protected IValue evaluateInstanceofExp(InstanceofExp e)
evaluateKindofExp
protected IValue evaluateKindofExp(KindofExp e)
evaluateLetExp
protected IValue evaluateLetExp(LetExp e)
evaluateLiteral
protected IValue evaluateLiteral(Literal l)
evaluateLiteralExp
protected IValue evaluateLiteralExp(LiteralExp e)
evaluateLockTestExp
protected IValue evaluateLockTestExp(LockTestExp e)
evaluateNewArrayExp
protected IValue evaluateNewArrayExp(NewArrayExp e)
evaluateNewRecordExp
protected IValue evaluateNewRecordExp(NewRecordExp e)
evaluateThreadTestExp
protected IValue evaluateThreadTestExp(ThreadTestExp e)
evaluateUnaryExp
protected IValue evaluateUnaryExp(UnaryExp e)
getOptionIds
public Collection<Triple<String,Boolean,OptionScope>> getOptionIds()
- Specified by:
getOptionIds
in interface ISelfDescribingModule
- Returns:
- a set of tuples whose first element says the name of the option,
and whose second element says whether the option is required,
and whose third element says whether the option is private to
this module (and thus prefixed by the interface implemented, e.g.,
edu.ksu.cis.projects.bogor.module.ISearcher
)
or global in scope (and thus no qualifier is prepended).
getOptionDomain
public Pair<Domain,Boolean> getOptionDomain(String id)
- Specified by:
getOptionDomain
in interface ISelfDescribingModule
- Returns:
- a tuple whose first element says the domain of the option values,
and whose second element says whether the option is multivalued
(that is, a comma-separated list)
getSuggestedValues
public Collection<String> getSuggestedValues(String id,
IBogorConfiguration bc,
SymbolTable st)
- Specified by:
getSuggestedValues
in interface ISelfDescribingModule
validate
public boolean validate(String id,
String value,
IBogorConfiguration bc,
SymbolTable st,
Collection<FileMessage> errors)
- Description copied from interface:
ISelfDescribingModule
- Checks whether the value of a configuration option is legal.
- Specified by:
validate
in interface ISelfDescribingModule
- Parameters:
id
- the option's name, as returned by the first tuple element of
an item returned by ISelfDescribingModule.getOptionIds()
value
- the value of the option, or null
if unconfiguedst
- the symbol table for the BIR modelerrors
- a container into which errors should be put. Implementors
should not assume that errors
is empty upon
entry into this method; it may aggregate the results of
calling validate
on many
ISelfDescribingModule
instances.
- Returns:
true
iff the option is supported and its value is legal