public abstract class ChoiceGeneratorBase<T> extends java.lang.Object implements ChoiceGenerator<T>
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
attr |
protected java.lang.String |
id |
protected int |
idRef |
protected Instruction |
insn |
protected boolean |
isCascaded |
protected boolean |
isDone |
static char |
MARKER |
protected ChoiceGenerator<?> |
prev |
protected static java.util.Random |
random |
protected int |
stateId |
protected ThreadInfo |
ti |
Modifier | Constructor and Description |
---|---|
protected |
ChoiceGeneratorBase()
Deprecated.
|
protected |
ChoiceGeneratorBase(java.lang.String id) |
Modifier and Type | Method and Description |
---|---|
void |
addAttr(java.lang.Object a) |
void |
advance(int nChoices)
advance n choices
pretty braindead generic solution, but if more speed is needed, we can easily override
in the concrete CGs (it's used for path replay)
|
ObjectList.Iterator |
attrIterator() |
<T> ObjectList.TypedIterator<T> |
attrIterator(java.lang.Class<T> attrType) |
ChoiceGeneratorBase<?> |
clone() |
ChoiceGenerator<?> |
deepClone() |
ChoiceGenerator<?>[] |
getAll()
return array with all parents and this CG, in registration order
|
T[] |
getAllChoices() |
<C extends ChoiceGenerator<?>> |
getAllOfType(java.lang.Class<C> cgType)
return array with all CGs (including this one) of given 'cgType', in registration order
|
java.lang.Object |
getAttr()
this returns all of them - use either if you know there will be only
one attribute at a time, or check/process result with ObjectList
|
<T> T |
getAttr(java.lang.Class<T> attrType)
this only returns the first attr of this type, there can be more
if you don't use client private types or the provided type is too general
|
ChoiceGenerator<?>[] |
getCascade()
return array with all cascaded parents and this CG, in registration order
|
ChoiceGenerator<?> |
getCascadedParent()
returns the prev CG if it was registered for the same insn
|
T |
getChoice(int idx)
explicit choice enumeration.
|
java.lang.String |
getId() |
int |
getIdRef() |
Instruction |
getInsn() |
<T> T |
getNextAttr(java.lang.Class<T> attrType,
java.lang.Object prev) |
int |
getNumberOfParents() |
ChoiceGenerator<?> |
getPreviousChoiceGenerator() |
<C extends ChoiceGenerator<?>> |
getPreviousChoiceGeneratorOfType(java.lang.Class<C> cls) |
T[] |
getProcessedChoices() |
java.lang.String |
getSourceLocation() |
int |
getStateId() |
ThreadInfo |
getThreadInfo() |
T[] |
getUnprocessedChoices() |
boolean |
hasAttr() |
boolean |
hasAttr(java.lang.Class<?> attrType) |
boolean |
hasAttrValue(java.lang.Object a) |
static void |
init(Config config) |
boolean |
isCascaded() |
boolean |
isDone() |
boolean |
isProcessed() |
boolean |
isSchedulingPoint() |
ChoiceGenerator<T> |
randomize()
turn the order of choices random (if it isn't already).
|
void |
removeAttr(java.lang.Object a) |
ChoiceGenerator<T> |
reorder(java.util.Comparator<T> comparator)
reorder according to a user provided comparator
|
void |
replaceAttr(java.lang.Object oldAttr,
java.lang.Object newAttr) |
void |
select(int choiceIndex) |
void |
setAttr(java.lang.Object a)
this replaces all of them - use only if you know
- there will be only one attribute at a time
- you obtained the value you set by a previous getXAttr()
- you constructed a multi value list with ObjectList.createList()
|
void |
setCascaded() |
void |
setContext(ThreadInfo tiCreator) |
void |
setCurrent()
to be called before the first advance().
|
void |
setDone() |
void |
setId(java.lang.String id) |
void |
setIdRef(int idRef) |
void |
setInsn(Instruction insn) |
void |
setPreviousChoiceGenerator(ChoiceGenerator<?> cg) |
void |
setStateId(int stateId) |
void |
setThreadInfo(ThreadInfo ti) |
boolean |
supportsReordering() |
java.lang.String |
toString() |
static boolean |
useRandomization() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
advance, getChoiceType, getNextChoice, getProcessedNumberOfChoices, getTotalNumberOfChoices, hasMoreChoices, reset
public static final char MARKER
protected static java.util.Random random
protected java.lang.String id
protected int idRef
protected boolean isDone
protected ChoiceGenerator<?> prev
protected Instruction insn
protected int stateId
protected ThreadInfo ti
protected java.lang.Object attr
protected boolean isCascaded
@Deprecated protected ChoiceGeneratorBase()
protected ChoiceGeneratorBase(java.lang.String id)
public static void init(Config config)
public static boolean useRandomization()
public ChoiceGeneratorBase<?> clone() throws java.lang.CloneNotSupportedException
clone
in interface ChoiceGenerator<T>
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public ChoiceGenerator<?> deepClone() throws java.lang.CloneNotSupportedException
deepClone
in interface ChoiceGenerator<T>
java.lang.CloneNotSupportedException
public java.lang.String getId()
getId
in interface ChoiceGenerator<T>
public int getIdRef()
getIdRef
in interface ChoiceGenerator<T>
public void setIdRef(int idRef)
setIdRef
in interface ChoiceGenerator<T>
public void setId(java.lang.String id)
setId
in interface ChoiceGenerator<T>
public boolean isSchedulingPoint()
isSchedulingPoint
in interface ChoiceGenerator<T>
public void setThreadInfo(ThreadInfo ti)
setThreadInfo
in interface ChoiceGenerator<T>
public ThreadInfo getThreadInfo()
getThreadInfo
in interface ChoiceGenerator<T>
public void setInsn(Instruction insn)
setInsn
in interface ChoiceGenerator<T>
public Instruction getInsn()
getInsn
in interface ChoiceGenerator<T>
public void setContext(ThreadInfo tiCreator)
setContext
in interface ChoiceGenerator<T>
public void setStateId(int stateId)
setStateId
in interface ChoiceGenerator<T>
public int getStateId()
getStateId
in interface ChoiceGenerator<T>
public java.lang.String getSourceLocation()
getSourceLocation
in interface ChoiceGenerator<T>
public boolean supportsReordering()
supportsReordering
in interface ChoiceGenerator<T>
public ChoiceGenerator<T> reorder(java.util.Comparator<T> comparator)
reorder
in interface ChoiceGenerator<T>
public void setPreviousChoiceGenerator(ChoiceGenerator<?> cg)
setPreviousChoiceGenerator
in interface ChoiceGenerator<T>
public void setCascaded()
setCascaded
in interface ChoiceGenerator<T>
public boolean isCascaded()
isCascaded
in interface ChoiceGenerator<T>
public <C extends ChoiceGenerator<?>> C getPreviousChoiceGeneratorOfType(java.lang.Class<C> cls)
getPreviousChoiceGeneratorOfType
in interface ChoiceGenerator<T>
public ChoiceGenerator<?> getCascadedParent()
getCascadedParent
in interface ChoiceGenerator<T>
public ChoiceGenerator<?>[] getCascade()
getCascade
in interface ChoiceGenerator<T>
public ChoiceGenerator<?>[] getAll()
getAll
in interface ChoiceGenerator<T>
public <C extends ChoiceGenerator<?>> C[] getAllOfType(java.lang.Class<C> cgType)
getAllOfType
in interface ChoiceGenerator<T>
public int getNumberOfParents()
getNumberOfParents
in interface ChoiceGenerator<T>
public void setCurrent()
ChoiceGenerator
setCurrent
in interface ChoiceGenerator<T>
public void advance(int nChoices)
advance
in interface ChoiceGenerator<T>
public void select(int choiceIndex)
select
in interface ChoiceGenerator<T>
public T getChoice(int idx)
getChoice
in interface ChoiceGenerator<T>
public T[] getAllChoices()
getAllChoices
in interface ChoiceGenerator<T>
public T[] getProcessedChoices()
getProcessedChoices
in interface ChoiceGenerator<T>
public T[] getUnprocessedChoices()
getUnprocessedChoices
in interface ChoiceGenerator<T>
public boolean isDone()
isDone
in interface ChoiceGenerator<T>
public void setDone()
setDone
in interface ChoiceGenerator<T>
public boolean isProcessed()
isProcessed
in interface ChoiceGenerator<T>
public boolean hasAttr()
hasAttr
in interface ChoiceGenerator<T>
public boolean hasAttr(java.lang.Class<?> attrType)
hasAttr
in interface ChoiceGenerator<T>
public boolean hasAttrValue(java.lang.Object a)
public java.lang.Object getAttr()
getAttr
in interface ChoiceGenerator<T>
public void setAttr(java.lang.Object a)
setAttr
in interface ChoiceGenerator<T>
public void addAttr(java.lang.Object a)
addAttr
in interface ChoiceGenerator<T>
public void removeAttr(java.lang.Object a)
removeAttr
in interface ChoiceGenerator<T>
public void replaceAttr(java.lang.Object oldAttr, java.lang.Object newAttr)
replaceAttr
in interface ChoiceGenerator<T>
public <T> T getAttr(java.lang.Class<T> attrType)
getAttr
in interface ChoiceGenerator<T>
public <T> T getNextAttr(java.lang.Class<T> attrType, java.lang.Object prev)
getNextAttr
in interface ChoiceGenerator<T>
public ObjectList.Iterator attrIterator()
attrIterator
in interface ChoiceGenerator<T>
public <T> ObjectList.TypedIterator<T> attrIterator(java.lang.Class<T> attrType)
attrIterator
in interface ChoiceGenerator<T>
public java.lang.String toString()
toString
in class java.lang.Object
public ChoiceGenerator<?> getPreviousChoiceGenerator()
getPreviousChoiceGenerator
in interface ChoiceGenerator<T>
public ChoiceGenerator<T> randomize()
ChoiceGenerator
randomize
in interface ChoiceGenerator<T>