public abstract class ChoiceGeneratorBase<T> extends Object implements ChoiceGenerator<T>
Modifier and Type | Field and Description |
---|---|
protected Object |
attr |
protected String |
id |
protected int |
idRef |
protected Instruction |
insn |
protected boolean |
isCascaded |
protected boolean |
isDone |
static char |
MARKER |
protected ChoiceGenerator<?> |
prev |
protected static Random |
random |
protected ThreadInfo |
ti |
Modifier | Constructor and Description |
---|---|
protected |
ChoiceGeneratorBase()
Deprecated.
|
protected |
ChoiceGeneratorBase(String id) |
Modifier and Type | Method and Description |
---|---|
void |
addAttr(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(Class<T> attrType) |
ChoiceGeneratorBase<?> |
clone() |
ChoiceGenerator<?> |
deepClone() |
ChoiceGenerator<?>[] |
getAll()
return array with all parents and this CG, in registration order
|
<C extends ChoiceGenerator<?>> |
getAllOfType(Class<C> cgType)
return array with all CGs (including this one) of given 'cgType', in registration order
|
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(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
|
String |
getId() |
int |
getIdRef() |
Instruction |
getInsn() |
<T> T |
getNextAttr(Class<T> attrType,
Object prev) |
ChoiceGenerator<?> |
getPreviousChoiceGenerator() |
<C extends ChoiceGenerator<?>> |
getPreviousChoiceGeneratorOfType(Class<C> cls) |
String |
getSourceLocation() |
ThreadInfo |
getThreadInfo() |
boolean |
hasAttr() |
boolean |
hasAttr(Class<?> attrType) |
boolean |
hasAttrValue(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(Object a) |
ChoiceGenerator<T> |
reorder(Comparator<T> comparator)
reorder according to a user provided comparator
|
void |
replaceAttr(Object oldAttr,
Object newAttr) |
void |
select(int nChoice) |
void |
setAttr(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 |
setDone() |
void |
setId(String id) |
void |
setIdRef(int idRef) |
void |
setInsn(Instruction insn) |
void |
setPreviousChoiceGenerator(ChoiceGenerator<?> cg) |
void |
setThreadInfo(ThreadInfo ti) |
boolean |
supportsReordering() |
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 Random random
protected String id
protected int idRef
protected boolean isDone
protected ChoiceGenerator<?> prev
protected Instruction insn
protected ThreadInfo ti
protected Object attr
protected boolean isCascaded
@Deprecated protected ChoiceGeneratorBase()
protected ChoiceGeneratorBase(String id)
public static void init(Config config)
public static boolean useRandomization()
public ChoiceGeneratorBase<?> clone() throws CloneNotSupportedException
clone
in interface ChoiceGenerator<T>
clone
in class Object
CloneNotSupportedException
public ChoiceGenerator<?> deepClone() throws CloneNotSupportedException
deepClone
in interface ChoiceGenerator<T>
CloneNotSupportedException
public 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(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 String getSourceLocation()
getSourceLocation
in interface ChoiceGenerator<T>
public boolean supportsReordering()
supportsReordering
in interface ChoiceGenerator<T>
public ChoiceGenerator<T> reorder(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(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(Class<C> cgType)
getAllOfType
in interface ChoiceGenerator<T>
public void advance(int nChoices)
advance
in interface ChoiceGenerator<T>
public void select(int nChoice)
select
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(Class<?> attrType)
hasAttr
in interface ChoiceGenerator<T>
public boolean hasAttrValue(Object a)
public Object getAttr()
getAttr
in interface ChoiceGenerator<T>
public void setAttr(Object a)
setAttr
in interface ChoiceGenerator<T>
public void addAttr(Object a)
addAttr
in interface ChoiceGenerator<T>
public void removeAttr(Object a)
removeAttr
in interface ChoiceGenerator<T>
public void replaceAttr(Object oldAttr, Object newAttr)
replaceAttr
in interface ChoiceGenerator<T>
public <T> T getAttr(Class<T> attrType)
getAttr
in interface ChoiceGenerator<T>
public <T> T getNextAttr(Class<T> attrType, Object prev)
getNextAttr
in interface ChoiceGenerator<T>
public ObjectList.Iterator attrIterator()
attrIterator
in interface ChoiceGenerator<T>
public <T> ObjectList.TypedIterator<T> attrIterator(Class<T> attrType)
attrIterator
in interface ChoiceGenerator<T>
public ChoiceGenerator<?> getPreviousChoiceGenerator()
getPreviousChoiceGenerator
in interface ChoiceGenerator<T>
public ChoiceGenerator<T> randomize()
ChoiceGenerator
randomize
in interface ChoiceGenerator<T>