mondrian.calc.impl
Class AbstractTupleList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<List<Member>>
          extended by mondrian.calc.impl.AbstractTupleList
All Implemented Interfaces:
Cloneable, Iterable<List<Member>>, Collection<List<Member>>, List<List<Member>>, RandomAccess, TupleIterable, TupleList
Direct Known Subclasses:
AbstractEndToEndTupleList, DelegatingTupleList

public abstract class AbstractTupleList
extends AbstractList<List<Member>>
implements RandomAccess, Cloneable, TupleList

Abstract implementation of TupleList.

Author:
jhyde

Nested Class Summary
protected  class AbstractTupleList.AbstractTupleListIterator
          Implementation of TupleIterator for ArrayTupleList.
 
Nested classes/interfaces inherited from interface mondrian.calc.TupleList
TupleList.PositionCallback
 
Field Summary
protected  int arity
           
protected  boolean mutable
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
AbstractTupleList(int arity)
           
 
Method Summary
 void addCurrent(TupleCursor tupleIter)
           
 TupleList fix()
          Fixes the tuples of this list, so that their contents will not change even if elements of the list are reordered or removed.
 Member get(int slice, int index)
          Returns a particular column of a particular row.
 int getArity()
          Returns the number of members in each tuple.
 Iterator<List<Member>> iterator()
           
abstract  TupleList subList(int fromIndex, int toIndex)
           
 TupleCursor tupleCursor()
          Creates a TupleCursor over this list.
 TupleIterator tupleIterator()
          Creates an iterator over the contents of this iterable.
protected abstract  TupleIterator tupleIteratorInternal()
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, get, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface mondrian.calc.TupleList
addTuple, cloneList, project, slice, withPositionCallback
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, toArray, toArray
 

Field Detail

arity

protected final int arity

mutable

protected boolean mutable
Constructor Detail

AbstractTupleList

public AbstractTupleList(int arity)
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

tupleIteratorInternal

protected abstract TupleIterator tupleIteratorInternal()

subList

public abstract TupleList subList(int fromIndex,
                                  int toIndex)
Specified by:
subList in interface List<List<Member>>
Specified by:
subList in interface TupleList
Overrides:
subList in class AbstractList<List<Member>>

fix

public TupleList fix()
Description copied from interface: TupleList
Fixes the tuples of this list, so that their contents will not change even if elements of the list are reordered or removed. Returns this list if possible.

Specified by:
fix in interface TupleList
Returns:
List whose tuples are invariant if the list is sorted or filtered

iterator

public final Iterator<List<Member>> iterator()
Specified by:
iterator in interface Iterable<List<Member>>
Specified by:
iterator in interface Collection<List<Member>>
Specified by:
iterator in interface List<List<Member>>
Overrides:
iterator in class AbstractList<List<Member>>

tupleIterator

public final TupleIterator tupleIterator()
Description copied from interface: TupleIterable
Creates an iterator over the contents of this iterable.

Always has the same effect as calling Iterable.iterator().

Specified by:
tupleIterator in interface TupleIterable
Returns:
cursor over the tuples returned by this iterable
See Also:
TupleIterable.tupleCursor()

tupleCursor

public TupleCursor tupleCursor()
Creates a TupleCursor over this list.

Any implementation of TupleList must implement all three methods iterator(), tupleIterator() and tupleCursor. The default implementation returns the same for all three, but a derived classes can override this method to create a more efficient implementation that implements cursor but not iterator.

Specified by:
tupleCursor in interface TupleIterable
Returns:
A cursor over this list

addCurrent

public void addCurrent(TupleCursor tupleIter)
Specified by:
addCurrent in interface TupleList

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
Parameters:
slice - Column ordinal
index - Row ordinal
Returns:
Member at given row and column

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads