ca.odell.glazedlists
Class GroupingList<E>
- EventListener, EventList<E>, List, ListEventListener<E>
public final class GroupingList<E>
A grouping list contains elements which are themselves Lists. Those Lists
are infact elements of the source list which have been grouped together into
a List. The logic of how to group the source elements is specified via a
Comparator. Elements for which the Comparator returns 0 are guaranteed to be
contained within the same group within this GroupingList. This implies
that source elements may only participate in a single group within this
GroupingList.
Further transformations may be layered on top of this GroupingList to
transform the group lists into any other desirable form.
Warning: This class is
thread ready but not thread safe. See
EventList
for an example
of thread safe code.
EventList Overview |
Writable: | yes |
Concurrency: | thread ready, not thread safe |
Performance: | reads: O(log N), writes O(log N) |
Memory: | |
Unit Tests: | GroupingListTest |
Issues: |
281
|
GroupingList(EventList source) - Creates a
GroupingList that determines groupings via the
Comparable interface which all elements of the source
are assumed to implement.
|
GroupingList(EventList source, E> comparator) - Creates a
GroupingList that determines groups using the specified
Comparator .
|
void | add(int index, List value) - This version of add will distribute all elements within the given
value List into groups.
|
void | dispose() -
|
static | extends Comparable super E>> GroupingList create(EventList source) - Creates a
GroupingList that determines groupings via the
Comparable interface which all elements of the source
are assumed to implement.
|
List | get(int index) -
|
protected int | getSourceIndex(int index) -
|
int | indexOfGroup(E groupElement) - Return the index of the group to which the
groupElement
would belong if it were hypothetically added to the source list.
|
protected boolean | isWritable() -
|
void | listChanged(ListEvent listChanges) -
|
List | remove(int index) -
|
List | set(int index, List value) -
|
void | setComparator(E> comparator) - Change the
Comparator which determines the groupings presented
by this List
|
int | size() -
|
add , addAll , clear , dispose , get , getSourceIndex , isWritable , listChanged , remove , removeAll , retainAll , set , size |
T[] toArray , add , add , addAll , addAll , addListEventListener , clear , contains , containsAll , equals , get , getPublisher , getReadWriteLock , hashCode , indexOf , isEmpty , iterator , lastIndexOf , listIterator , listIterator , remove , remove , removeAll , removeListEventListener , retainAll , set , size , subList , toArray , toString |
GroupingList
public GroupingList(EventList source)
Creates a
GroupingList
that determines groupings via the
Comparable
interface which all elements of the
source
are assumed to implement.
Usage of factory method
create(EventList)
is preferable.
GroupingList
public GroupingList(EventList source,
E> comparator)
Creates a
GroupingList
that determines groups using the specified
Comparator
.
source
- the EventList
containing elements to be groupedcomparator
- the Comparator
used to determine groupings
add
public void add(int index,
List value)
This version of add will distribute all elements within the given
value
List into groups. Existing groups will be reused and
new groups will be created as needed. As such, the
index
argument is meaningless.
Warning: This method
breaks the contract required by
List.add(int, Object)
.
extends Comparable super E>> GroupingList create
public static > GroupingList create(EventList source)
Creates a
GroupingList
that determines groupings via the
Comparable
interface which all elements of the
source
are assumed to implement.
indexOfGroup
public int indexOfGroup(E groupElement)
Return the index of the group to which the groupElement
would belong if it were hypothetically added to the source list. Note
that groupElement
does NOT have to exist
in a group. This method is essentially a convenient way to locate a
group based on a prototypical element of that group.
groupElement
- a prototype element of the group to locate
- the index of the group that would contain
groupElement
if it were added to the source list or -1
if no
currently existing group would contain the groupElement
set
public List set(int index,
List value)
setComparator
public void setComparator(E> comparator)
Change the Comparator
which determines the groupings presented
by this List
comparator
- the Comparator
used to determine groupings;
null will be treated as GlazedLists.comparableComparator()
Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by pbuilder at 2009-07-14 22:05