Package randoop.sequence
Class TupleSequence
- java.lang.Object
-
- randoop.sequence.TupleSequence
-
public final class TupleSequence extends Object
A Sequence that produces a tuple or collection of values, all of the same type.To make a new sequence requires choosing an operation, choosing a value (really, a previously-created sequence and one of its outputs) for each of the operation's inputs, and then concatenating all the input sequences along with the new operation. Most operations take a well-defined number and type of inputs. This helper class supports calling operations that take a variable number of inputs -- namely, array and list creation.
Ordinarily:
- Each Sequence consists of a single operation (the final statement) and its inputs. Those inputs are individually chosen and may be of different types, because the operation takes multiple types of arguments.
- Each Sequence creates multiple values: the value produced by its last statement, and the values that might be side-effected by its last statement.
- Each valid Sequence is output as a regression test. All of its values are in the pool, and when Randoop needs a value, it might choose any of them. Only one of its outputs is used when it is used as a component in a larger sequence.
- It is created as the concatenation of valid sequences, without an operation at the end.
- Its outputs are one value from each of the sequences that created it.
- It is not output as a regression test, but is used as one of the inputs to an array- or list-producing operation that will be output. All of its outputs are used.
-
-
Field Summary
Fields Modifier and Type Field Description private List<Integer>
outputIndices
The list of statement indices that define outputs of this sequence.Sequence
sequence
The underlying sequence.
-
Constructor Summary
Constructors Constructor Description TupleSequence(List<Sequence> sequences, List<Integer> variables)
Create a TupleSequence that concatenates the given sequences, choosing the given variable from each.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TupleSequence
createElementsSequence(SimpleList<Sequence> candidates, int length, Type elementType)
Selects sequences as element values for creating a collection.List<Integer>
getOutputIndices()
Returns the list of output indices.
-
-
-
Constructor Detail
-
TupleSequence
public TupleSequence(List<Sequence> sequences, List<Integer> variables)
Create a TupleSequence that concatenates the given sequences, choosing the given variable from each.- Parameters:
sequences
- that will be concatenated to make the new TupleSequencevariables
- one index per sequence insequences
, defining the outputs of the TupleSequence
-
-
Method Detail
-
getOutputIndices
public List<Integer> getOutputIndices()
Returns the list of output indices.- Returns:
- the list of output indices for this sequence
-
createElementsSequence
public static TupleSequence createElementsSequence(SimpleList<Sequence> candidates, int length, Type elementType)
Selects sequences as element values for creating a collection.- Parameters:
candidates
- the sequences from which to selectlength
- the number of values to selectelementType
- the type of elements- Returns:
- a sequence with subsequences that create element values for a collection
-
-