Class UnaryTupleList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<List<Member>>
-
- mondrian.calc.impl.UnaryTupleList
-
- All Implemented Interfaces:
Iterable<List<Member>>
,Collection<List<Member>>
,List<List<Member>>
,TupleIterable
,TupleList
public class UnaryTupleList extends AbstractList<List<Member>> implements TupleList
Implementation ofTupleList
where the tuples are unary (each tuple consists of just oneMember
).It is implemented as a straightforward wrapper on a backing list. You can provide the backing list explicitly using the
UnaryTupleList(java.util.List)
constructor, and you can access the backing list by callingslice(int)
(0).- Author:
- jhyde
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface mondrian.calc.TupleList
TupleList.PositionCallback
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description UnaryTupleList()
Creates an empty UnaryTupleList.UnaryTupleList(List<Member> list)
Creates a UnaryTupleList with a given backing list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, List<Member> element)
boolean
add(List<Member> element)
void
addCurrent(TupleCursor tupleIter)
void
addTuple(Member... members)
void
clear()
TupleList
cloneList(int capacity)
Creates a copy of this list that has the same type and has a given capacity.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.List<Member>
get(int index)
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()
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)
TupleCursor
tupleCursor()
Creates a cursor over the contents of this iterable.TupleIterator
tupleIterator()
Creates an iterator over the contents of this iterable.TupleList
withPositionCallback(TupleList.PositionCallback positionCallback)
-
Methods inherited from class java.util.AbstractList
addAll, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, removeRange
-
Methods inherited from class java.util.AbstractCollection
addAll, 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
addAll, addAll, contains, containsAll, equals, hashCode, indexOf, isEmpty, lastIndexOf, listIterator, listIterator, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
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.
-
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.
-
clear
public void clear()
-
size
public int size()
-
getArity
public int getArity()
Description copied from interface:TupleIterable
Returns the number of members in each tuple.- Specified by:
getArity
in interfaceTupleIterable
- Returns:
- The number of members in each tuple
-
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.
- Specified by:
slice
in interfaceTupleIterable
- Specified by:
slice
in interfaceTupleList
- 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.
-
tupleCursor
public TupleCursor tupleCursor()
Description copied from interface:TupleIterable
Creates a cursor over the contents of this iterable.The contents of the cursor will always be the same as those returned by
TupleIterable.tupleIterator()
. BecauseTupleCursor
is a simpler API to implement thanTupleIterator
, in some cases the implementation may be more efficient.- Specified by:
tupleCursor
in interfaceTupleIterable
- Returns:
- cursor over the tuples returned by this iterable
-
tupleIterator
public 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 interfaceTupleIterable
- Returns:
- cursor over the tuples returned by this iterable
- See Also:
TupleIterable.tupleCursor()
-
addCurrent
public void addCurrent(TupleCursor tupleIter)
- Specified by:
addCurrent
in interfaceTupleList
-
subList
public TupleList subList(int fromIndex, int toIndex)
-
withPositionCallback
public TupleList withPositionCallback(TupleList.PositionCallback positionCallback)
- Specified by:
withPositionCallback
in interfaceTupleList
-
-