Class ArrayTupleList

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Iterable<java.util.List<Member>>, java.util.Collection<java.util.List<Member>>, java.util.List<java.util.List<Member>>, java.util.RandomAccess, TupleIterable, TupleList

    public class ArrayTupleList
    extends AbstractEndToEndTupleList
    Implementation of TupleList that stores tuples end-to-end in an array.
    Author:
    jhyde
    • Constructor Summary

      Constructors 
      Constructor Description
      ArrayTupleList​(int arity)
      Creates an empty ArrayTupleList with an initial capacity of 10 tuples.
      ArrayTupleList​(int arity, int initialCapacity)
      Creates an empty ArrayTupleList.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, java.util.List<Member> members)  
      boolean add​(java.util.List<Member> members)  
      boolean addAll​(int index, java.util.Collection<? extends java.util.List<Member>> c)  
      void addCurrent​(TupleCursor tupleIter)  
      void addTuple​(Member... members)  
      protected java.util.List<Member> backingList()  
      TupleList cloneList​(int capacity)
      Creates a copy of this list that has the same type and has a given capacity.
      java.util.List<Member> get​(int index)  
      Member get​(int slice, int index)
      Returns a particular column of a particular row.
      java.util.List<Member> remove​(int index)  
      java.util.List<Member> set​(int index, java.util.List<Member> element)  
      int size()  
      java.util.List<Member> slice​(int column)
      Returns a list of the members at a given column.
      TupleIterator tupleIteratorInternal()  
      • Methods inherited from class java.util.AbstractList

        clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, removeRange
      • Methods inherited from class java.util.AbstractCollection

        contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, lastIndexOf, listIterator, listIterator, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
    • Constructor Detail

      • ArrayTupleList

        public ArrayTupleList​(int arity)
        Creates an empty ArrayTupleList with an initial capacity of 10 tuples.
        Parameters:
        arity - Arity
      • ArrayTupleList

        public ArrayTupleList​(int arity,
                              int initialCapacity)
        Creates an empty ArrayTupleList.
        Parameters:
        arity - Arity
        initialCapacity - Initial capacity
    • Method Detail

      • get

        public Member get​(int slice,
                          int index)
        Description copied from interface: TupleList
        Returns a particular column of a particular row.

        Note that list.get(row, column) is equivalent to list.slice(column).get(row) and list.get(row).get(column) but is more efficient for most implementations of TupleList.

        Specified by:
        get in interface TupleList
        Overrides:
        get in class AbstractTupleList
        Parameters:
        slice - Column ordinal
        index - Row ordinal
        Returns:
        Member at given row and column
      • get

        public java.util.List<Member> get​(int index)
        Specified by:
        get in interface java.util.List<java.util.List<Member>>
        Specified by:
        get in class java.util.AbstractList<java.util.List<Member>>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<java.util.List<Member>>
        Specified by:
        size in interface java.util.List<java.util.List<Member>>
        Specified by:
        size in class java.util.AbstractCollection<java.util.List<Member>>
      • add

        public boolean add​(java.util.List<Member> members)
        Specified by:
        add in interface java.util.Collection<java.util.List<Member>>
        Specified by:
        add in interface java.util.List<java.util.List<Member>>
        Overrides:
        add in class java.util.AbstractList<java.util.List<Member>>
      • add

        public void add​(int index,
                        java.util.List<Member> members)
        Specified by:
        add in interface java.util.List<java.util.List<Member>>
        Overrides:
        add in class java.util.AbstractList<java.util.List<Member>>
      • addAll

        public boolean addAll​(int index,
                              java.util.Collection<? extends java.util.List<Member>> c)
        Specified by:
        addAll in interface java.util.List<java.util.List<Member>>
        Overrides:
        addAll in class AbstractEndToEndTupleList
      • addTuple

        public void addTuple​(Member... members)
      • remove

        public java.util.List<Member> remove​(int index)
        Specified by:
        remove in interface java.util.List<java.util.List<Member>>
        Overrides:
        remove in class java.util.AbstractList<java.util.List<Member>>
      • slice

        public java.util.List<Member> slice​(int column)
        Description copied from interface: TupleList
        Returns a list of the members at a given column.

        The list is modifiable if and only if this TupleList is modifiable. Adding an element to a slice will create a tuple whose members in other columns are null. Removing an element from a slicer will remove a tuple.

        Parameters:
        column - Ordinal of the member in each tuple to project
        Returns:
        List of members
      • cloneList

        public TupleList cloneList​(int capacity)
        Description copied from interface: TupleList
        Creates a copy of this list that has the same type and has a given capacity.

        If capacity is negative, populates the list. A deep copy is made, so that it the contents of the list are not affected to changes to any backing collections.

        Parameters:
        capacity - Capacity
        Returns:
        Copy of list, empty if capacity is non-negative