Class AbstractTupleIterable

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

    public abstract class AbstractTupleIterable
    extends java.lang.Object
    implements TupleIterable
    Abstract implementation of TupleIterable.

    Derived classes need to implement only TupleIterable.tupleCursor(), and this implementation will implement tupleIterator() and iterator() by creating a wrapper around that cursor. (The cursor interface is easier to implement efficiently than the wider iterator interface.) If you have a more efficient implementation of cursor, override the tupleIterator method.

    Author:
    jhyde
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int arity  
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractTupleIterable​(int arity)
      Creates an AbstractTupleIterable.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getArity()
      Returns the number of members in each tuple.
      java.util.Iterator<java.util.List<Member>> iterator()  
      java.lang.Iterable<Member> slice​(int column)
      Returns an iterable over the members at a given column.
      TupleIterator tupleIterator()
      Creates an iterator over the contents of this iterable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • arity

        protected final int arity
    • Constructor Detail

      • AbstractTupleIterable

        public AbstractTupleIterable​(int arity)
        Creates an AbstractTupleIterable.
        Parameters:
        arity - Arity (number of members per tuple)
    • Method Detail

      • getArity

        public int getArity()
        Description copied from interface: TupleIterable
        Returns the number of members in each tuple.
        Specified by:
        getArity in interface TupleIterable
        Returns:
        The number of members in each tuple
      • slice

        public java.lang.Iterable<Member> slice​(int column)
        Description copied from interface: TupleIterable
        Returns an iterable over the members at a given column.

        The iteratble returns an interator that is modifiable if and only if this TupleIterable is modifiable.

        If this TupleIterable happens to be a TupleList, the method is overridden to return a List<Member>.

        Specified by:
        slice in interface TupleIterable
        Parameters:
        column - Ordinal of the member in each tuple to project
        Returns:
        Iterable that returns an iterator over members
      • iterator

        public final java.util.Iterator<java.util.List<Member>> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.util.List<Member>>