ca.odell.glazedlists

Class FilterList<E>

Implemented Interfaces:
EventListener, EventList<E>, List, ListEventListener<E>

public final class FilterList<E>
extends TransformedList<S,E>

An EventList that shows a subset of the elements of a source EventList. This subset is composed of all elements of the source EventList that match the filter.

The filter can be static or dynamic. Changing the behaviour of the filter will change which elements of the source list are included.

Warning: This class breaks the contract required by java.util.List. See EventList for an example.

EventList Overview
Writable:yes
Concurrency:thread ready, not thread safe
Performance:reads: O(log N), writes O(log N), filter changes O(N)
Memory:0 to 26 bytes per element
Unit Tests:N/A
Issues: 1 2 7 46 187 254 312
Authors:
Jesse Wilson
James Lemieux

Field Summary

Fields inherited from class ca.odell.glazedlists.TransformedList<S,E>

source

Fields inherited from class ca.odell.glazedlists.AbstractEventList<E>

publisher, readWriteLock, updates

Constructor Summary

FilterList(EventList source)
Creates a FilterList that includes a subset of the specified source EventList.
FilterList(EventList source, E> matcher)
Convenience constructor for creating a FilterList and setting its Matcher.
FilterList(EventList source, E> matcherEditor)
Convenience constructor for creating a FilterList and setting its MatcherEditor.

Method Summary

void
dispose()
protected int
getSourceIndex(int mutationIndex)
protected boolean
isWritable()
void
listChanged(ListEvent listChanges)
void
setMatcher(E> matcher)
Set the Matcher which specifies which elements shall be filtered.
void
setMatcherEditor(E> editor)
Set the MatcherEditor which provides a dynamic Matcher to determine which elements shall be filtered.
int
size()

Methods inherited from class ca.odell.glazedlists.TransformedList<S,E>

add, addAll, clear, dispose, get, getSourceIndex, isWritable, listChanged, remove, removeAll, retainAll, set, size

Methods inherited from class ca.odell.glazedlists.AbstractEventList<E>

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

Constructor Details

FilterList

public FilterList(EventList source)
Creates a FilterList that includes a subset of the specified source EventList.

FilterList

public FilterList(EventList source,
                  E> matcher)

FilterList

public FilterList(EventList source,
                  E> matcherEditor)

Method Details

dispose

public void dispose()
Overrides:
dispose in interface TransformedList<S,E>

getSourceIndex

protected final int getSourceIndex(int mutationIndex)
Overrides:
getSourceIndex in interface TransformedList<S,E>

isWritable

protected boolean isWritable()
Overrides:
isWritable in interface TransformedList<S,E>

listChanged

public final void listChanged(ListEvent listChanges)
Specified by:
listChanged in interface ListEventListener<E>

setMatcher

public void setMatcher(E> matcher)
Set the Matcher which specifies which elements shall be filtered.

This will remove the current Matcher or MatcherEditor and refilter the entire list.


setMatcherEditor

public void setMatcherEditor(E> editor)
Set the MatcherEditor which provides a dynamic Matcher to determine which elements shall be filtered.

This will remove the current Matcher or MatcherEditor and refilter the entire list.


size

public final int size()
Overrides:
size in interface TransformedList<S,E>

Glazed Lists, Copyright © 2003-2006 publicobject.com, O'Dell Engineering.
Documentation build by pbuilder at 2007-12-21 23:49