public class ComponentManager
extends java.lang.Object
This class manages different collections of component sequences:
SEED SEQUENCES. Seed sequences are the initial sequences provided to the generation process. They include (1) sequences passed via the constructor, (2) class literals, and (3) package literals. The only different treatment of seed sequences is during calls to the clearGeneratedSequences() method, which removes only general, non-seed components from the collection.
Modifier and Type | Field and Description |
---|---|
private ClassLiterals |
classLiterals
Components representing literals that should only be used as input to specific classes.
|
private SequenceCollection |
gralComponents
The principal set of sequences used to create other, larger sequences by the generator.
|
private java.util.Collection<Sequence> |
gralSeeds
The sequences that were given pre-generation to the component manager (via its constructor).
|
private @Nullable PackageLiterals |
packageLiterals
A set of additional components representing literals that should only be used as input to
specific packages.
|
Constructor and Description |
---|
ComponentManager()
Create an empty component manager, with an empty seed sequence set.
|
ComponentManager(java.util.Collection<Sequence> generalSeeds)
Create a component manager, initially populated with the given sequences, which are considered
seed sequences.
|
Modifier and Type | Method and Description |
---|---|
void |
addClassLevelLiteral(ClassOrInterfaceType type,
Sequence seq)
Add a sequence representing a literal value that can be used when testing members of the given
class.
|
void |
addGeneratedSequence(Sequence sequence)
Add a component sequence.
|
void |
addPackageLevelLiteral(java.lang.Package pkg,
Sequence seq)
Add a sequence representing a literal value that can be used when testing classes in the given
package.
|
(package private) void |
clearGeneratedSequences()
Removes any components sequences added so far, except for seed sequences, which are preserved.
|
(package private) java.util.Set<Sequence> |
getAllGeneratedSequences()
Returns the set of all generated sequences.
|
(package private) java.util.Set<Sequence> |
getAllPrimitiveSequences()
Returns all sequences that represent primitive values (e.g.
|
(package private) SimpleList<Sequence> |
getSequencesForType(Type cls)
Returns all the general component sequences that create values of the given class.
|
(package private) SimpleList<Sequence> |
getSequencesForType(TypedOperation operation,
int i,
boolean onlyReceivers)
Returns component sequences that create values of the type required by the i-th input value of
a statement that invokes the given operation.
|
(package private) TypeInstantiator |
getTypeInstantiator() |
void |
log() |
int |
numGeneratedSequences()
Returns the number of (non-seed) sequences stored by the manager.
|
private SequenceCollection gralComponents
clearGeneratedSequences()
.private final java.util.Collection<Sequence> gralSeeds
Seeds are all contained in gralComponents
. This list is kept to restore seeds if
the user calls clearGeneratedSequences()
.
private ClassLiterals classLiterals
Null if class literals are not used or none were found. At most one of classLiterals and packageliterals is non-null.
private @Nullable PackageLiterals packageLiterals
Null if package literals are not used or none were found. At most one of classLiterals and packageliterals is non-null.
public ComponentManager()
public ComponentManager(java.util.Collection<Sequence> generalSeeds)
generalSeeds
- seed sequences. Can be null, in which case the seed sequences set is
considered empty.public int numGeneratedSequences()
ComponentManager
public void addClassLevelLiteral(ClassOrInterfaceType type, Sequence seq)
type
- the class literal to add for the sequenceseq
- the sequencepublic void addPackageLevelLiteral(java.lang.Package pkg, Sequence seq)
pkg
- the package to add for the sequenceseq
- the sequencepublic void addGeneratedSequence(Sequence sequence)
sequence
- the sequencevoid clearGeneratedSequences()
java.util.Set<Sequence> getAllGeneratedSequences()
SimpleList<Sequence> getSequencesForType(Type cls)
cls
- the query typeSimpleList<Sequence> getSequencesForType(TypedOperation operation, int i, boolean onlyReceivers)
operation
- the statementi
- the input value index of statementonlyReceivers
- if true, only return sequences that are appropriate to use as a method
call receiverjava.util.Set<Sequence> getAllPrimitiveSequences()
TypeInstantiator getTypeInstantiator()
public void log()