Package com.luciad.lucy.util
Class ALcyCompositeFilter<T>
java.lang.Object
com.luciad.lucy.util.ALcyCompositeFilter<T>
- All Implemented Interfaces:
ILcdChangeSource
,ILcdDynamicFilter<T>
,ILcdFilter<T>
,Serializable
,Predicate<T>
- Direct Known Subclasses:
TLcyCompositeAndFilter
Abstract implementation of a composite filter according to composite design
pattern. The exact behavior of how the added filters are combined, is left up
to the sub-classes.
Holds a collection of non null ILcdFilter instances.
- See Also:
-
Constructor Summary
ConstructorDescriptionConstructs a newALcyCompositeFilter
, having no associatedILcdFilter
s. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChangeListener
(ILcdChangeListener aListener) Registers the given listener so it will receive change events from this source.void
addFilter
(ILcdFilter<T> aFilter) Adds the given filter to this composite filter.protected void
Indicates this filter has changed.getFilter
(int aIndex) Returns the filter at the given index.int
Returns the amount ifILcdFilter
s currently associated.void
removeChangeListener
(ILcdChangeListener aListener) Removes the specified listener so it is no longer notified.void
removeFilter
(ILcdFilter<T> aFilter) Removes the given filter from this composite filter.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.util.ILcdFilter
accept, test
-
Constructor Details
-
ALcyCompositeFilter
public ALcyCompositeFilter()Constructs a newALcyCompositeFilter
, having no associatedILcdFilter
s.
-
-
Method Details
-
addFilter
Adds the given filter to this composite filter.- Parameters:
aFilter
- The filter to add. Must be different from null.- See Also:
-
removeFilter
Removes the given filter from this composite filter. Does nothing if the givenILcdFilter
is not associated to this composite filter.- Parameters:
aFilter
- The filter to remove.- See Also:
-
getFilterCount
public int getFilterCount()Returns the amount ifILcdFilter
s currently associated.- Returns:
- the amount if
ILcdFilter
s currently associated. - See Also:
-
getFilter
Returns the filter at the given index.- Parameters:
aIndex
- The index to retrieve theILcdFilter
at.0 <= aIndex <= getFilterCount()
- Returns:
- the filter at the given index.
- See Also:
-
addChangeListener
Description copied from interface:ILcdChangeSource
Registers the given listener so it will receive change events from this source.
In case you need to register a listener which keeps a reference to an object with a shorter life-time than this change source, you can use a
ALcdWeakChangeListener
instance as change listener.- Specified by:
addChangeListener
in interfaceILcdChangeSource
- Parameters:
aListener
- The listener to be notified when a change has happened.- See Also:
-
removeChangeListener
Description copied from interface:ILcdChangeSource
Removes the specified listener so it is no longer notified.- Specified by:
removeChangeListener
in interfaceILcdChangeSource
- Parameters:
aListener
- The listener to remove.
-
fireChangeEvent
protected void fireChangeEvent()Indicates this filter has changed.
Extensions of this class should not call this method when a filter is added or removed. In such cases a change event is already fired.
When a filter which is added implements
ILcdChangeSource
this class will already fire a change event when the added filter indicates it is changed. In such cases, it is not needed to call this method from the subclass.
-