Package mondrian.calc.impl
Class ArrayTupleList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<List<Member>>
-
- mondrian.calc.impl.AbstractTupleList
-
- mondrian.calc.impl.ArrayTupleList
-
- All Implemented Interfaces:
Cloneable
,Iterable<List<Member>>
,Collection<List<Member>>
,List<List<Member>>
,RandomAccess
,TupleIterable
,TupleList
public class ArrayTupleList extends AbstractTupleList
Implementation ofTupleList
that stores tuples end-to-end in an array.- Author:
- jhyde
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class mondrian.calc.impl.AbstractTupleList
AbstractTupleList.AbstractTupleListIterator
-
Nested classes/interfaces inherited from interface mondrian.calc.TupleList
TupleList.PositionCallback
-
-
Field Summary
-
Fields inherited from class mondrian.calc.impl.AbstractTupleList
arity, mutable
-
Fields inherited from class java.util.AbstractList
modCount
-
-
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, List<Member> members)
boolean
add(List<Member> members)
boolean
addAll(int index, Collection<? extends List<Member>> c)
boolean
addAll(Collection<? extends List<Member>> c)
void
addCurrent(TupleCursor tupleIter)
void
addTuple(Member... members)
protected List<Member>
backingList()
TupleList
cloneList(int capacity)
Creates a copy of this list that has the same type and has a given capacity.boolean
equals(Object o)
List<Member>
get(int index)
Member
get(int slice, int index)
Returns a particular column of a particular row.int
hashCode()
TupleList
project(int[] destIndices)
List<Member>
remove(int index)
List<Member>
set(int index, List<Member> element)
int
size()
List<Member>
slice(int column)
Returns a list of the members at a given column.TupleList
subList(int fromIndex, int toIndex)
TupleIterator
tupleIteratorInternal()
TupleList
withPositionCallback(TupleList.PositionCallback positionCallback)
-
Methods inherited from class mondrian.calc.impl.AbstractTupleList
fix, getArity, iterator, tupleCursor, tupleIterator
-
Methods inherited from class java.util.AbstractList
clear, 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.util.List
clear, contains, containsAll, 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
- ArityinitialCapacity
- 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 tolist.slice(column).get(row)
andlist.get(row).get(column)
but is more efficient for most implementations of TupleList.- Specified by:
get
in interfaceTupleList
- Overrides:
get
in classAbstractTupleList
- Parameters:
slice
- Column ordinalindex
- Row ordinal- Returns:
- Member at given row and column
-
addCurrent
public void addCurrent(TupleCursor tupleIter)
- Specified by:
addCurrent
in interfaceTupleList
- Overrides:
addCurrent
in classAbstractTupleList
-
size
public int size()
-
addAll
public boolean addAll(int index, Collection<? extends List<Member>> c)
-
addTuple
public void addTuple(Member... members)
-
slice
public 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
-
tupleIteratorInternal
public TupleIterator tupleIteratorInternal()
- Specified by:
tupleIteratorInternal
in classAbstractTupleList
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
-
project
public TupleList project(int[] destIndices)
-
addAll
public boolean addAll(Collection<? extends List<Member>> c)
-
subList
public TupleList subList(int fromIndex, int toIndex)
-
withPositionCallback
public TupleList withPositionCallback(TupleList.PositionCallback positionCallback)
-
-