public class TupleSet<E>
extends java.lang.Object
E
.Modifier and Type | Field and Description |
---|---|
private int |
tupleLength
The length of tuples in the set.
|
private java.util.List<java.util.List<E>> |
tuples
The list of element lists (tuples).
|
Modifier | Constructor and Description |
---|---|
|
TupleSet()
Creates a tuple set with a single empty tuple.
|
private |
TupleSet(java.util.List<java.util.List<E>> tuples,
int tupleLength) |
Modifier and Type | Method and Description |
---|---|
TupleSet<E> |
exhaustivelyExtend(java.util.List<E> elements)
Creates a new tuple set from this set, where each tuple has been augmented by one element.
|
TupleSet<E> |
extend(java.util.List<E> elements)
Extends each element of this tuple set with each of the elements of the given list.
|
private java.util.List<E> |
extendTuple(java.util.List<E> tuple,
E e)
Returns a new list that is formed by inserting the element at the end.
|
private java.util.List<E> |
insertInTuple(java.util.List<E> tuple,
E e,
int i)
Returns a new list that is formed by inserting the element at the given position.
|
java.util.List<java.util.List<E>> |
tuples()
Returns the tuples.
|
private java.util.List<java.util.List<E>> tuples
private int tupleLength
public TupleSet()
private TupleSet(java.util.List<java.util.List<E>> tuples, int tupleLength)
public java.util.List<java.util.List<E>> tuples()
public TupleSet<E> extend(java.util.List<E> elements)
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.
elements
- the list of elementspublic TupleSet<E> exhaustivelyExtend(java.util.List<E> elements)
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.
elements
- the list of elementsprivate java.util.List<E> extendTuple(java.util.List<E> tuple, E e)
tuple
- the original liste
- the element to insertprivate java.util.List<E> insertInTuple(java.util.List<E> tuple, E e, int i)
tuple
- the original liste
- the element to inserti
- the position where element is to be inserted