edu.ksu.cis.projects.bogor.module
Class DefaultActionTaker

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.module.DefaultActionTaker
All Implemented Interfaces:
ISelfDescribingModule, IActionTaker, IModule, Disposable

public class DefaultActionTaker
extends Object
implements IActionTaker, ISelfDescribingModule

Version:
CVS $Revision: 1.30 $ $Date: 2005/06/09 19:24:37 $
Author:
Robby , Matt Hoosier

Field Summary
protected  IActionTaker at
           
protected  IBacktrackingInfoFactory bif
           
protected  IExpEvaluator ee
           
protected  Map<ExtSymbolTable,IModule> extTable
           
protected  IStateFactory sf
           
protected  ISearcher sr
           
protected  ISchedulingStrategist ss
           
protected  ISchedulingStrategyContext ssc
           
protected  ISchedulingStrategyInfo ssi
           
protected  SymbolTable symbolTable
           
protected  IValueFactory vf
           
protected  Map<IRecordValue,IntSet> writtenFieldsTable
           
protected  IntSet writtenGlobals
           
protected  Set<IValue> writtenValues
           
 
Constructor Summary
DefaultActionTaker()
           
 
Method Summary
protected  IValue checkRange(Type fromType, Type toType, IValue value)
           
 IMessageStore connect(IBogorConfiguration bc)
          Connects this modules to other modules.
 void dispose()
          Remove references.
 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 setSchedulingStrategyContextInfo(ISchedulingStrategyContext ssc, ISchedulingStrategyInfo ssi)
           
 void setWrittenFieldsTable(Map<IRecordValue,IntSet> writtenFieldsTable)
           
 void setWrittenGlobalSet(IntSet writtenGlobals)
           
 void setWrittenValueSet(Set<IValue> writtenValues)
           
 IBacktrackingInfo takeAction(ISchedulingStrategyContext ssc, Action a)
           
 INoChangeBacktrackingInfo takeAssertAction(AssertAction a, IIntValue value)
           
 IArrayElementBacktrackingInfo takeAssignArrayElementAction(AssignAction a, IArrayValue array, int elementIndex, IValue value)
           
 IFieldBacktrackingInfo takeAssignFieldAction(AssignAction a, IRecordValue record, int fieldIndex, IValue value)
           
 IGlobalBacktrackingInfo takeAssignGlobalAction(AssignAction a, int globalIndex, IValue value)
           
 ILocalBacktrackingInfo takeAssignLocalAction(AssignAction a, int localIndex, IValue value)
           
 IBacktrackingInfo takeAssumeAction(AssumeAction a, IIntValue value)
           
 IExitThreadBacktrackingInfo takeExitThreadAction(ExitThreadAction a)
           
 ILockBacktrackingInfo takeLockAction(LockAction a, ILockValue value)
           
 INoChangeBacktrackingInfo takePrintAction(PrintAction a)
           
 IStartThreadBacktrackingInfo takeStartThreadAction(StartThreadExp e)
           
 void takeThrowAction(ThrowAction a, IRecordValue value)
           
 void unsetSchedulingStrategyContextInfo()
           
 boolean validate(String id, String value, IBogorConfiguration bc, SymbolTable st, Collection<FileMessage> errors)
          Checks whether the value of a configuration option is legal.
protected  IBacktrackingInfo visitAssertAction(AssertAction node)
           
protected  IBacktrackingInfo visitAssignAction(AssignAction node)
           
protected  IBacktrackingInfo visitAssumeAction(AssumeAction node)
           
protected  IBacktrackingInfo visitExpAction(ExpAction node)
           
protected  IBacktrackingInfo visitExtExp(ExtExp e)
           
protected  IBacktrackingInfo visitLockAction(LockAction node)
           
protected  void visitThrowAction(ThrowAction node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

at

protected IActionTaker at

bif

protected IBacktrackingInfoFactory bif

ee

protected IExpEvaluator ee

ss

protected ISchedulingStrategist ss

ssc

protected ISchedulingStrategyContext ssc

ssi

protected ISchedulingStrategyInfo ssi

sr

protected ISearcher sr

sf

protected IStateFactory sf

vf

protected IValueFactory vf

symbolTable

protected SymbolTable symbolTable

extTable

protected Map<ExtSymbolTable,IModule> extTable

writtenGlobals

protected IntSet writtenGlobals

writtenValues

protected Set<IValue> writtenValues

writtenFieldsTable

protected Map<IRecordValue,IntSet> writtenFieldsTable
Constructor Detail

DefaultActionTaker

public DefaultActionTaker()
Method Detail

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.

setSchedulingStrategyContextInfo

public void setSchedulingStrategyContextInfo(ISchedulingStrategyContext ssc,
                                             ISchedulingStrategyInfo ssi)
Specified by:
setSchedulingStrategyContextInfo in interface IActionTaker

setWrittenFieldsTable

public void setWrittenFieldsTable(Map<IRecordValue,IntSet> writtenFieldsTable)
Specified by:
setWrittenFieldsTable in interface IActionTaker

setWrittenGlobalSet

public void setWrittenGlobalSet(IntSet writtenGlobals)
Specified by:
setWrittenGlobalSet in interface IActionTaker

setWrittenValueSet

public void setWrittenValueSet(Set<IValue> writtenValues)
Specified by:
setWrittenValueSet in interface IActionTaker

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

takeAction

public IBacktrackingInfo takeAction(ISchedulingStrategyContext ssc,
                                    Action a)
Specified by:
takeAction in interface IActionTaker

takeAssertAction

public INoChangeBacktrackingInfo takeAssertAction(AssertAction a,
                                                  IIntValue value)
Specified by:
takeAssertAction in interface IActionTaker

takeAssignArrayElementAction

public IArrayElementBacktrackingInfo takeAssignArrayElementAction(AssignAction a,
                                                                  IArrayValue array,
                                                                  int elementIndex,
                                                                  IValue value)
Specified by:
takeAssignArrayElementAction in interface IActionTaker

takeAssignFieldAction

public IFieldBacktrackingInfo takeAssignFieldAction(AssignAction a,
                                                    IRecordValue record,
                                                    int fieldIndex,
                                                    IValue value)
Specified by:
takeAssignFieldAction in interface IActionTaker

takeAssignGlobalAction

public IGlobalBacktrackingInfo takeAssignGlobalAction(AssignAction a,
                                                      int globalIndex,
                                                      IValue value)
Specified by:
takeAssignGlobalAction in interface IActionTaker

takeAssignLocalAction

public ILocalBacktrackingInfo takeAssignLocalAction(AssignAction a,
                                                    int localIndex,
                                                    IValue value)
Specified by:
takeAssignLocalAction in interface IActionTaker

takeAssumeAction

public IBacktrackingInfo takeAssumeAction(AssumeAction a,
                                          IIntValue value)
Specified by:
takeAssumeAction in interface IActionTaker

takeExitThreadAction

public IExitThreadBacktrackingInfo takeExitThreadAction(ExitThreadAction a)
Specified by:
takeExitThreadAction in interface IActionTaker

takeLockAction

public ILockBacktrackingInfo takeLockAction(LockAction a,
                                            ILockValue value)
Specified by:
takeLockAction in interface IActionTaker

takePrintAction

public INoChangeBacktrackingInfo takePrintAction(PrintAction a)
Specified by:
takePrintAction in interface IActionTaker

takeStartThreadAction

public IStartThreadBacktrackingInfo takeStartThreadAction(StartThreadExp e)
Specified by:
takeStartThreadAction in interface IActionTaker

takeThrowAction

public void takeThrowAction(ThrowAction a,
                            IRecordValue value)
Specified by:
takeThrowAction in interface IActionTaker

unsetSchedulingStrategyContextInfo

public void unsetSchedulingStrategyContextInfo()
Specified by:
unsetSchedulingStrategyContextInfo in interface IActionTaker

getFSMSymbolTable

protected FSMSymbolTable getFSMSymbolTable()

checkRange

protected IValue checkRange(Type fromType,
                            Type toType,
                            IValue value)

visitAssertAction

protected IBacktrackingInfo visitAssertAction(AssertAction node)

visitAssignAction

protected IBacktrackingInfo visitAssignAction(AssignAction node)

visitAssumeAction

protected IBacktrackingInfo visitAssumeAction(AssumeAction node)

visitExpAction

protected IBacktrackingInfo visitExpAction(ExpAction node)

visitExtExp

protected IBacktrackingInfo visitExtExp(ExtExp e)

visitLockAction

protected IBacktrackingInfo visitLockAction(LockAction node)

visitThrowAction

protected void visitThrowAction(ThrowAction node)

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)
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 getOptionIds()
value - the value of the option, or null if unconfigued
st - the symbol table for the BIR model
errors - 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