Package mondrian.calc.impl
Class AbstractTupleIterable
- java.lang.Object
-
- mondrian.calc.impl.AbstractTupleIterable
-
- All Implemented Interfaces:
Iterable<List<Member>>,TupleIterable
public abstract class AbstractTupleIterable extends Object implements TupleIterable
Abstract implementation ofTupleIterable.Derived classes need to implement only
TupleIterable.tupleCursor(), and this implementation will implementtupleIterator()anditerator()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 thetupleIteratormethod.- Author:
- jhyde
-
-
Field Summary
Fields Modifier and Type Field Description protected intarity
-
Constructor Summary
Constructors Constructor Description AbstractTupleIterable(int arity)Creates an AbstractTupleIterable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetArity()Returns the number of members in each tuple.Iterator<List<Member>>iterator()Iterable<Member>slice(int column)Returns an iterable over the members at a given column.TupleIteratortupleIterator()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
-
Methods inherited from interface mondrian.calc.TupleIterable
tupleCursor
-
-
-
-
Method Detail
-
getArity
public int getArity()
Description copied from interface:TupleIterableReturns the number of members in each tuple.- Specified by:
getArityin interfaceTupleIterable- Returns:
- The number of members in each tuple
-
slice
public Iterable<Member> slice(int column)
Description copied from interface:TupleIterableReturns 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
TupleIterablehappens to be aTupleList, the method is overridden to return aList<Member>.- Specified by:
slicein interfaceTupleIterable- Parameters:
column- Ordinal of the member in each tuple to project- Returns:
- Iterable that returns an iterator over members
-
tupleIterator
public TupleIterator tupleIterator()
Description copied from interface:TupleIterableCreates an iterator over the contents of this iterable.Always has the same effect as calling
Iterable.iterator().- Specified by:
tupleIteratorin interfaceTupleIterable- Returns:
- cursor over the tuples returned by this iterable
- See Also:
TupleIterable.tupleCursor()
-
-