edu.ksu.cis.projects.bogor.module.backtrack
Class DefaultBacktrackingInfoFactory

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

public class DefaultBacktrackingInfoFactory
extends Object
implements IBacktrackingInfoFactory, ISelfDescribingModule

Version:
CVS $Revision: 1.22 $ $Date: 2005/06/06 19:15:32 $
Author:
Robby , Matt Hoosier

Field Summary
protected  IStateFactory sf
           
protected  ISchedulingStrategist ss
           
protected  IValueFactory vf
           
 
Constructor Summary
DefaultBacktrackingInfoFactory()
           
 
Method Summary
 IMessageStore connect(IBogorConfiguration bc)
          Connects this modules to other modules.
 IArrayElementBacktrackingInfo createArrayElementBacktrackingInfo(int stateId, int threadId, Action action, IArrayValue arrayValue, int elementIndex, IValue oldValue, ISchedulingStrategyInfo ssi)
           
 IControlTransferBacktrackingInfo createControlTransferBacktrackingInfo(int stateId, int threadId, int locDesc, IntObjectTable<IValue> deadLocalValues, Transformation t, ISchedulingStrategyInfo ssi)
           
 IEndStateBacktrackingInfo createEndStateBacktrackingInfo(int stateId, int threadId, Action a, ISchedulingStrategyInfo ssi)
           
 IEnterFunctionBacktrackingInfo createEnterFunctionBacktrackingInfo(int stateId, int threadId, InvokeTransformation t, ISchedulingStrategyInfo ssi)
           
 IExceptionBacktrackingInfo createExceptionBacktrackingInfo(int stateId, BogorException throwable, Node node, int threadId, int[] threadLocationStack, int[] threadTransformationIndexStack, IValueArray[] threadLocalValuesStack, int threadLockCount, boolean isUncaught, ISchedulingStrategyInfo ssi, IExceptionBacktrackingInfo.IExceptionKilledThreadInfo[] collateralThreadInfos)
           
 IExceptionBacktrackingInfo.IExceptionKilledThreadInfo createExceptionKilledThreadInfo(int threadId, int[] threadLocationStack, int[] threadTransformationIndexStack, IValueArray[] threadLocalValuesStack, int threadLockCount)
           
 IExitFunctionBacktrackingInfo createExitFunctionBacktrackingInfo(int stateId, int threadId, int locDesc, int transformationIndex, IValueArray localValues, IValue returnValue, ISchedulingStrategyInfo ssi)
           
 IExitThreadBacktrackingInfo createExitThreadBacktrackingInfo(int stateId, int threadId, Action action, int[] threadLocationStack, int[] threadTransformationIndexStack, IValueArray[] threadLocalValuesStack, ISchedulingStrategyInfo ssi)
           
 IFieldBacktrackingInfo createFieldBacktrackingInfo(int stateId, int threadId, Action action, IRecordValue arrayOrRecordValue, int fieldIndex, IValue oldValue, ISchedulingStrategyInfo ssi)
           
 IGlobalBacktrackingInfo createGlobalBacktrackingInfo(int stateId, int threadId, Action action, int globalIndex, IDoubleValue oldValue, ISchedulingStrategyInfo ssi)
           
 IGlobalBacktrackingInfo createGlobalBacktrackingInfo(int stateId, int threadId, Action action, int globalIndex, IFloatValue oldValue, ISchedulingStrategyInfo ssi)
           
 IGlobalBacktrackingInfo createGlobalBacktrackingInfo(int stateId, int threadId, Action action, int globalIndex, IIntValue oldValue, ISchedulingStrategyInfo ssi)
           
 IGlobalBacktrackingInfo createGlobalBacktrackingInfo(int stateId, int threadId, Action action, int globalIndex, ILongValue oldValue, ISchedulingStrategyInfo ssi)
           
 IGlobalBacktrackingInfo createGlobalBacktrackingInfo(int stateId, int threadId, Action action, int globalIndex, INonPrimitiveValue oldValue, ISchedulingStrategyInfo ssi)
           
 IGlobalBacktrackingInfo createGlobalBacktrackingInfo(int stateId, int threadId, Action action, int globalIndex, IPrimitiveExtValue oldValue, ISchedulingStrategyInfo ssi)
           
 IGlobalBacktrackingInfo createGlobalBacktrackingInfo(int stateId, int threadId, Action action, int globalIndex, IValue oldValue, ISchedulingStrategyInfo ssi)
           
 ILocalBacktrackingInfo createLocalBacktrackingInfo(int stateId, int threadId, Node node, int localIndex, IDoubleValue oldValue, ISchedulingStrategyInfo ssi)
           
 ILocalBacktrackingInfo createLocalBacktrackingInfo(int stateId, int threadId, Node node, int localIndex, IFloatValue oldValue, ISchedulingStrategyInfo ssi)
           
 ILocalBacktrackingInfo createLocalBacktrackingInfo(int stateId, int threadId, Node node, int localIndex, IIntValue oldValue, ISchedulingStrategyInfo ssi)
           
 ILocalBacktrackingInfo createLocalBacktrackingInfo(int stateId, int threadId, Node node, int localIndex, ILongValue oldValue, ISchedulingStrategyInfo ssi)
           
 ILocalBacktrackingInfo createLocalBacktrackingInfo(int stateId, int threadId, Node node, int localIndex, INonPrimitiveValue oldValue, ISchedulingStrategyInfo ssi)
           
 ILocalBacktrackingInfo createLocalBacktrackingInfo(int stateId, int threadId, Node node, int localIndex, IPrimitiveExtValue oldValue, ISchedulingStrategyInfo ssi)
           
 ILocalBacktrackingInfo createLocalBacktrackingInfo(int stateId, int threadId, Node node, int localIndex, IValue oldValue, ISchedulingStrategyInfo ssi)
           
 ILockBacktrackingInfo createLockBacktrackingInfo(int stateId, int threadId, Action action, LockOp lockOp, ILockValue lockValue, int owner, int lockCounter, int[] waiting, int[] notification, int oldLockCount, int notifiedThreadId, ISchedulingStrategyInfo ssi)
           
 INoChangeBacktrackingInfo createNoChangeBacktrackingInfo(int stateId, int threadId, Action action, ISchedulingStrategyInfo ssi)
           
 IStartThreadBacktrackingInfo createStartThreadBacktrackingInfo(int stateId, int threadId, int startedThreadId, int oldThreadIdSeed, Action action, ISchedulingStrategyInfo ssi)
           
 ITransformationsBacktrackingInfo createTransformationsBacktrackingInfo(int stateId, int invisibleMoves, int threadId, int[] threadIds, int threadIndex, int lastMovedThreadId, Transformation[] transformations, int selectedIndex, boolean isInvisible, ISchedulingStrategyInfo ssi)
           
 void dispose()
          Remove references.
 String getCopyrightNotice()
          Returns the copyright notice for this module.
static ITransformationsBacktrackingInfo getMostRecentTransformation(ArrayList<IBacktrackingInfo> stack)
           
 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.
 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
 

Field Detail

ss

protected ISchedulingStrategist ss

vf

protected IValueFactory vf

sf

protected IStateFactory sf
Constructor Detail

DefaultBacktrackingInfoFactory

public DefaultBacktrackingInfoFactory()
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.

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.

createArrayElementBacktrackingInfo

public IArrayElementBacktrackingInfo createArrayElementBacktrackingInfo(int stateId,
                                                                        int threadId,
                                                                        Action action,
                                                                        IArrayValue arrayValue,
                                                                        int elementIndex,
                                                                        IValue oldValue,
                                                                        ISchedulingStrategyInfo ssi)
Specified by:
createArrayElementBacktrackingInfo in interface IBacktrackingInfoFactory

createControlTransferBacktrackingInfo

public IControlTransferBacktrackingInfo createControlTransferBacktrackingInfo(int stateId,
                                                                              int threadId,
                                                                              int locDesc,
                                                                              IntObjectTable<IValue> deadLocalValues,
                                                                              Transformation t,
                                                                              ISchedulingStrategyInfo ssi)
Specified by:
createControlTransferBacktrackingInfo in interface IBacktrackingInfoFactory

createEndStateBacktrackingInfo

public IEndStateBacktrackingInfo createEndStateBacktrackingInfo(int stateId,
                                                                int threadId,
                                                                Action a,
                                                                ISchedulingStrategyInfo ssi)
Specified by:
createEndStateBacktrackingInfo in interface IBacktrackingInfoFactory

createEnterFunctionBacktrackingInfo

public IEnterFunctionBacktrackingInfo createEnterFunctionBacktrackingInfo(int stateId,
                                                                          int threadId,
                                                                          InvokeTransformation t,
                                                                          ISchedulingStrategyInfo ssi)
Specified by:
createEnterFunctionBacktrackingInfo in interface IBacktrackingInfoFactory

createExceptionKilledThreadInfo

public IExceptionBacktrackingInfo.IExceptionKilledThreadInfo createExceptionKilledThreadInfo(int threadId,
                                                                                             int[] threadLocationStack,
                                                                                             int[] threadTransformationIndexStack,
                                                                                             IValueArray[] threadLocalValuesStack,
                                                                                             int threadLockCount)
Specified by:
createExceptionKilledThreadInfo in interface IBacktrackingInfoFactory

createExceptionBacktrackingInfo

public IExceptionBacktrackingInfo createExceptionBacktrackingInfo(int stateId,
                                                                  BogorException throwable,
                                                                  Node node,
                                                                  int threadId,
                                                                  int[] threadLocationStack,
                                                                  int[] threadTransformationIndexStack,
                                                                  IValueArray[] threadLocalValuesStack,
                                                                  int threadLockCount,
                                                                  boolean isUncaught,
                                                                  ISchedulingStrategyInfo ssi,
                                                                  IExceptionBacktrackingInfo.IExceptionKilledThreadInfo[] collateralThreadInfos)
Specified by:
createExceptionBacktrackingInfo in interface IBacktrackingInfoFactory

createExitFunctionBacktrackingInfo

public IExitFunctionBacktrackingInfo createExitFunctionBacktrackingInfo(int stateId,
                                                                        int threadId,
                                                                        int locDesc,
                                                                        int transformationIndex,
                                                                        IValueArray localValues,
                                                                        IValue returnValue,
                                                                        ISchedulingStrategyInfo ssi)
Specified by:
createExitFunctionBacktrackingInfo in interface IBacktrackingInfoFactory

createExitThreadBacktrackingInfo

public IExitThreadBacktrackingInfo createExitThreadBacktrackingInfo(int stateId,
                                                                    int threadId,
                                                                    Action action,
                                                                    int[] threadLocationStack,
                                                                    int[] threadTransformationIndexStack,
                                                                    IValueArray[] threadLocalValuesStack,
                                                                    ISchedulingStrategyInfo ssi)
Specified by:
createExitThreadBacktrackingInfo in interface IBacktrackingInfoFactory

createFieldBacktrackingInfo

public IFieldBacktrackingInfo createFieldBacktrackingInfo(int stateId,
                                                          int threadId,
                                                          Action action,
                                                          IRecordValue arrayOrRecordValue,
                                                          int fieldIndex,
                                                          IValue oldValue,
                                                          ISchedulingStrategyInfo ssi)
Specified by:
createFieldBacktrackingInfo in interface IBacktrackingInfoFactory

createGlobalBacktrackingInfo

public IGlobalBacktrackingInfo createGlobalBacktrackingInfo(int stateId,
                                                            int threadId,
                                                            Action action,
                                                            int globalIndex,
                                                            IValue oldValue,
                                                            ISchedulingStrategyInfo ssi)
Specified by:
createGlobalBacktrackingInfo in interface IBacktrackingInfoFactory

createGlobalBacktrackingInfo

public IGlobalBacktrackingInfo createGlobalBacktrackingInfo(int stateId,
                                                            int threadId,
                                                            Action action,
                                                            int globalIndex,
                                                            INonPrimitiveValue oldValue,
                                                            ISchedulingStrategyInfo ssi)

createGlobalBacktrackingInfo

public IGlobalBacktrackingInfo createGlobalBacktrackingInfo(int stateId,
                                                            int threadId,
                                                            Action action,
                                                            int globalIndex,
                                                            IPrimitiveExtValue oldValue,
                                                            ISchedulingStrategyInfo ssi)

createGlobalBacktrackingInfo

public IGlobalBacktrackingInfo createGlobalBacktrackingInfo(int stateId,
                                                            int threadId,
                                                            Action action,
                                                            int globalIndex,
                                                            IIntValue oldValue,
                                                            ISchedulingStrategyInfo ssi)

createGlobalBacktrackingInfo

public IGlobalBacktrackingInfo createGlobalBacktrackingInfo(int stateId,
                                                            int threadId,
                                                            Action action,
                                                            int globalIndex,
                                                            ILongValue oldValue,
                                                            ISchedulingStrategyInfo ssi)

createGlobalBacktrackingInfo

public IGlobalBacktrackingInfo createGlobalBacktrackingInfo(int stateId,
                                                            int threadId,
                                                            Action action,
                                                            int globalIndex,
                                                            IFloatValue oldValue,
                                                            ISchedulingStrategyInfo ssi)

createGlobalBacktrackingInfo

public IGlobalBacktrackingInfo createGlobalBacktrackingInfo(int stateId,
                                                            int threadId,
                                                            Action action,
                                                            int globalIndex,
                                                            IDoubleValue oldValue,
                                                            ISchedulingStrategyInfo ssi)

createLocalBacktrackingInfo

public ILocalBacktrackingInfo createLocalBacktrackingInfo(int stateId,
                                                          int threadId,
                                                          Node node,
                                                          int localIndex,
                                                          IValue oldValue,
                                                          ISchedulingStrategyInfo ssi)
Specified by:
createLocalBacktrackingInfo in interface IBacktrackingInfoFactory

createLocalBacktrackingInfo

public ILocalBacktrackingInfo createLocalBacktrackingInfo(int stateId,
                                                          int threadId,
                                                          Node node,
                                                          int localIndex,
                                                          IIntValue oldValue,
                                                          ISchedulingStrategyInfo ssi)

createLocalBacktrackingInfo

public ILocalBacktrackingInfo createLocalBacktrackingInfo(int stateId,
                                                          int threadId,
                                                          Node node,
                                                          int localIndex,
                                                          ILongValue oldValue,
                                                          ISchedulingStrategyInfo ssi)

createLocalBacktrackingInfo

public ILocalBacktrackingInfo createLocalBacktrackingInfo(int stateId,
                                                          int threadId,
                                                          Node node,
                                                          int localIndex,
                                                          IFloatValue oldValue,
                                                          ISchedulingStrategyInfo ssi)

createLocalBacktrackingInfo

public ILocalBacktrackingInfo createLocalBacktrackingInfo(int stateId,
                                                          int threadId,
                                                          Node node,
                                                          int localIndex,
                                                          IDoubleValue oldValue,
                                                          ISchedulingStrategyInfo ssi)

createLocalBacktrackingInfo

public ILocalBacktrackingInfo createLocalBacktrackingInfo(int stateId,
                                                          int threadId,
                                                          Node node,
                                                          int localIndex,
                                                          INonPrimitiveValue oldValue,
                                                          ISchedulingStrategyInfo ssi)

createLocalBacktrackingInfo

public ILocalBacktrackingInfo createLocalBacktrackingInfo(int stateId,
                                                          int threadId,
                                                          Node node,
                                                          int localIndex,
                                                          IPrimitiveExtValue oldValue,
                                                          ISchedulingStrategyInfo ssi)

createLockBacktrackingInfo

public ILockBacktrackingInfo createLockBacktrackingInfo(int stateId,
                                                        int threadId,
                                                        Action action,
                                                        LockOp lockOp,
                                                        ILockValue lockValue,
                                                        int owner,
                                                        int lockCounter,
                                                        int[] waiting,
                                                        int[] notification,
                                                        int oldLockCount,
                                                        int notifiedThreadId,
                                                        ISchedulingStrategyInfo ssi)
Specified by:
createLockBacktrackingInfo in interface IBacktrackingInfoFactory

createNoChangeBacktrackingInfo

public INoChangeBacktrackingInfo createNoChangeBacktrackingInfo(int stateId,
                                                                int threadId,
                                                                Action action,
                                                                ISchedulingStrategyInfo ssi)
Specified by:
createNoChangeBacktrackingInfo in interface IBacktrackingInfoFactory

createStartThreadBacktrackingInfo

public IStartThreadBacktrackingInfo createStartThreadBacktrackingInfo(int stateId,
                                                                      int threadId,
                                                                      int startedThreadId,
                                                                      int oldThreadIdSeed,
                                                                      Action action,
                                                                      ISchedulingStrategyInfo ssi)
Specified by:
createStartThreadBacktrackingInfo in interface IBacktrackingInfoFactory

createTransformationsBacktrackingInfo

public ITransformationsBacktrackingInfo createTransformationsBacktrackingInfo(int stateId,
                                                                              int invisibleMoves,
                                                                              int threadId,
                                                                              int[] threadIds,
                                                                              int threadIndex,
                                                                              int lastMovedThreadId,
                                                                              Transformation[] transformations,
                                                                              int selectedIndex,
                                                                              boolean isInvisible,
                                                                              ISchedulingStrategyInfo ssi)
Specified by:
createTransformationsBacktrackingInfo in interface IBacktrackingInfoFactory
Parameters:
stateId - fingerprint of state most recently stored in current DFS descent
invisibleMoves - number of invisible moves which have been consecutively executed since state indicated by stateId was stored
threadId - the descriptor of the thread taking this transformation
threadIds - the descriptors of the threads which would have executed each of the possible next moves given by transformations
threadIndex - the offset within the array of currently alive thread descriptors (as given by IState.getThreadIds()) at which threadId lives
lastMovedThreadId - prior value of an internal variable possibly used by searcher implementation
transformations - the possible next moves which could have been taken out of the state for which this move was made
selectedIndex - the offset within threadIds and transformations which gives this move (and the thread which executed it)
isInvisible - indicates whether this move will be invisible
ssi - scheduling bookkeeping information

dispose

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

Specified by:
dispose in interface Disposable

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 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

getMostRecentTransformation

public static ITransformationsBacktrackingInfo getMostRecentTransformation(ArrayList<IBacktrackingInfo> stack)