Package randoop.util
Class TupleSet<E>
- java.lang.Object
-
- randoop.util.TupleSet<E>
-
public class TupleSet<E> extends Object
Represents a non-empty set of tuples. All the tuples have the same length. The tuple elements have typeE
.
-
-
Field Summary
Fields Modifier and Type Field Description private int
tupleLength
The length of tuples in the set.private List<List<E>>
tuples
The list of element lists (tuples).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TupleSet<E>
exhaustivelyExtend(List<E> elements)
Creates a new tuple set from this set, where each tuple has been augmented by one element.TupleSet<E>
extend(List<E> elements)
Extends each element of this tuple set with each of the elements of the given list.private List<E>
extendTuple(List<E> tuple, E e)
Returns a new list that is formed by inserting the element at the end.private List<E>
insertInTuple(List<E> tuple, E e, int i)
Returns a new list that is formed by inserting the element at the given position.List<List<E>>
tuples()
Returns the tuples.
-
-
-
Method Detail
-
extend
public TupleSet<E> extend(List<E> elements)
Extends each element of this tuple set with each of the elements of the given list.Suppose this contains k tuples each of length len, and
elements
contains e elements. Then the result contains k * e tuples, each of length len+1.- Parameters:
elements
- the list of elements- Returns:
- a tuple set formed by extending the tuples with the elements of the given list
-
exhaustivelyExtend
public TupleSet<E> exhaustivelyExtend(List<E> elements)
Creates a new tuple set from this set, where each tuple has been augmented by one element.Suppose that each tuple of this has length tlen, and only 1 element is given. Then each tuple will be be replaced by tlen+1 tuples, each of length tlen+1 and containing the original tuple plus one element, at an arbitrary location in the tuple.
If k elements are given, then each tuple will be be replaced by k * (tlen+1) tuples, each of length tlen+1.
- Parameters:
elements
- the list of elements- Returns:
- a tuple set formed by inserting elements of the given list into the tuples of this set
-
extendTuple
private List<E> extendTuple(List<E> tuple, E e)
Returns a new list that is formed by inserting the element at the end. Does not side-effect its argument.- Parameters:
tuple
- the original liste
- the element to insert- Returns:
- a new list with the element inserted at the end
-
insertInTuple
private List<E> insertInTuple(List<E> tuple, E e, int i)
Returns a new list that is formed by inserting the element at the given position. Does not side-effect its argument.- Parameters:
tuple
- the original liste
- the element to inserti
- the position where element is to be inserted- Returns:
- a new list with the element inserted at the given position
-
-