ca.odell.glazedlists
Class SequenceList<E>
- EventListener, EventList<E>, List, ListEventListener<E>
public final class SequenceList<E>
A SequenceList contains values in adjacent indices which occur at predictable
intervals from each other. A simple SequenceList could be:
{-10, -5, 0, 5, 10, 15}
while a more sophisticated example could be:
{Jun 1, Jul 1, Aug 1, Sep 1, Oct 1}
As long as the values can be ordered via a
Comparator
and a
SequenceList.Sequencer
can be implemented to reliably produce the next or previous
value in a sequence using only some value from the source list.
SequenceList is a readonly list; calling any write method on this list
will produce an
UnsupportedOperationException
.
The start and end values of the sequence are the smallest sequence values
which maintain the invariant that:
sequence start <= each value in the source list <= sequence end
EventList Overview |
Writable: | no |
Concurrency: | thread ready, not thread safe |
Performance: | reads: O(1) |
Memory: | O(N) |
Unit Tests: | SequenceListTest |
Issues: | N/A |
static interface | SequenceList.Sequencer - A Sequencer defines the logic required to calculate the previous and
next sequence values given any value.
|
SequenceList(EventList source, Sequencer sequencer) - Constructs a SequenceList containing a sequence of values produced by
the
sequencer which cover the range of values contained
within the source .
|
SequenceList(EventList source, Sequencer sequencer, Comparator comparator) - Constructs a SequenceList containing a sequence of values produced by
the
sequencer which cover the range of values contained
within the source .
|
E | get(int index) -
|
E | getNextSequenceValue(E value) - Returns the next value in the sequence defined by this list or
value itself if it is a sequence value.
|
E | getPreviousSequenceValue(E value) - Returns the previous value in the sequence defined by this list or
value itself if it is a sequence value.
|
void | listChanged(ListEvent listChanges) -
|
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 |
SequenceList
public SequenceList(EventList source,
Sequencer sequencer)
Constructs a SequenceList containing a sequence of values produced by
the sequencer
which cover the range of values contained
within the source
.
source
- the raw values to build a sequence aroundsequencer
- the logic to produce sequence values relative to a value
SequenceList
public SequenceList(EventList source,
Sequencer sequencer,
Comparator comparator)
Constructs a SequenceList containing a sequence of values produced by
the sequencer
which cover the range of values contained
within the source
. The given comparator
determines the order of the sequence values.
source
- the raw values to build a sequence aroundsequencer
- the logic to produce sequence values relative to a value
getNextSequenceValue
public E getNextSequenceValue(E value)
Returns the next value in the sequence defined by this list or
value
itself if it is a sequence value.
value
- the value relative to which the next sequence value is returned
- the next sequence value relative to the given
value
getPreviousSequenceValue
public E getPreviousSequenceValue(E value)
Returns the previous value in the sequence defined by this list or
value
itself if it is a sequence value.
value
- the value relative to which the previous sequence value is returned
- the previous sequence value relative to the given
value
Glazed Lists, Copyright © 2003-2006 publicobject.com, O'Dell Engineering.
Documentation build by buildd at 2008-01-04 14:38