Package randoop.util

Class 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 type E.
    • Field Detail

      • tuples

        private List<List<E>> tuples
        The list of element lists (tuples).
      • tupleLength

        private int tupleLength
        The length of tuples in the set.
    • Constructor Detail

      • TupleSet

        public TupleSet()
        Creates a tuple set with a single empty tuple.
      • TupleSet

        private TupleSet​(List<List<E>> tuples,
                         int tupleLength)
    • Method Detail

      • tuples

        public List<List<E>> tuples()
        Returns the tuples.
        Returns:
        the tuples
      • 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 list
        e - 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 list
        e - the element to insert
        i - the position where element is to be inserted
        Returns:
        a new list with the element inserted at the given position