org.palo.api.subsets.filter
Class SortingFilter

java.lang.Object
  extended by org.palo.api.subsets.filter.SortingFilter
All Implemented Interfaces:
StructuralFilter, SubsetFilter

public class SortingFilter
extends java.lang.Object
implements StructuralFilter

SortingFilter

A sorting filter belongs to the category of structural filters. This filter defines different sorting criteria to influence the element sequence of the subset as well as the possibility to create an element hierarchy.

Version:
$Id: SortingFilter.html,v 1.5 2009/07/09 11:01:46 ArndHouben Exp $

Field Summary
 
Fields inherited from interface org.palo.api.subsets.SubsetFilter
TYPE_ALIAS, TYPE_ATTRIBUTE, TYPE_DATA, TYPE_HIERARCHICAL, TYPE_PICKLIST, TYPE_SORTING, TYPE_TEXT
 
Constructor Summary
SortingFilter(Dimension dimension)
          Deprecated. use SortingFilter(Hierarchy) instead.
SortingFilter(Dimension dimension, SortingFilterSetting setting)
          Deprecated. use SortingFilter(Hierarchy, SortingFilterSetting) instead.
SortingFilter(Hierarchy hierarchy)
          Creates a new SortingFilter instance for the given hierarchy
SortingFilter(Hierarchy hierarchy, SortingFilterSetting setting)
          Creates a new SortingFilter instance for the given hierarchy with the given settings
 
Method Summary
 void adapt(SubsetFilter from)
          Adapts this subset filter from the given one.
 void add(EffectiveFilter filter)
          Adds the given EffectiveFilter to the list of all affective filters which affect this subset filter
 void bind(Subset2 subset)
          Binds this filter instance to the given Subset2 NOTE: PLEASE DON'T USE!
 SortingFilter copy()
          Creates a deep copy of this subset filter
 void filter(java.util.List<ElementNode> hierarchy, java.util.Set<Element> elements)
          Filters the given element hierarchy represented by ElementNodes.
 Dimension getDimension()
           
 Hierarchy getHierarchy()
          Convenient method to access the subset hierarchy.
 SortingFilterSetting getSettings()
          Returns the internal settings of this filter.
 Subset2 getSubset()
          Returns the Subset2 to which this filter belongs or null if this filter isn't bind to a subset yet.
 int getType()
          Returns the filter type which is one of the defined type constants.
 void initialize()
          Initializes this filter.
 void remove(EffectiveFilter filter)
          Removes the given EffectiveFilter from the list of all affective filters which affect this subset filter
 void reset()
          Resets this filter, i.e. its internal setting is switched back to its default.
 java.util.List<ElementNode> sort(java.util.Set<Element> elements)
          Sorts the given subset element list using the current settings.
 void unbind()
          Releases this filter instance from a previously binded Subset2 NOTE: PLEASE DON'T USE!
 void validateSettings()
          Checks if the internal subset settings are valid.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.palo.api.subsets.SubsetFilter
adapt, add, bind, getHierarchy, getSubset, remove, reset, unbind
 

Constructor Detail

SortingFilter

public SortingFilter(Dimension dimension)
Deprecated. use SortingFilter(Hierarchy) instead.

Creates a new SortingFilter instance for the given dimension

Parameters:
dimension - the dimension to create the filter for

SortingFilter

public SortingFilter(Hierarchy hierarchy)
Creates a new SortingFilter instance for the given hierarchy

Parameters:
hierarchy - the hierarchy to create the filter for

SortingFilter

public SortingFilter(Dimension dimension,
                     SortingFilterSetting setting)
Deprecated. use SortingFilter(Hierarchy, SortingFilterSetting) instead.

Creates a new SortingFilter instance for the given dimension with the given settings

Parameters:
dimension - the dimension to create the filter for
setting - the filter settings to use

SortingFilter

public SortingFilter(Hierarchy hierarchy,
                     SortingFilterSetting setting)
Creates a new SortingFilter instance for the given hierarchy with the given settings

Parameters:
hierarchy - the hierarchy to create the filter for
setting - the filter settings to use
Method Detail

copy

public final SortingFilter copy()
Description copied from interface: SubsetFilter
Creates a deep copy of this subset filter

Specified by:
copy in interface SubsetFilter
Returns:
a copy of this subset filter

getSettings

public final SortingFilterSetting getSettings()
Description copied from interface: SubsetFilter
Returns the internal settings of this filter.

Specified by:
getSettings in interface SubsetFilter
Returns:

sort

public final java.util.List<ElementNode> sort(java.util.Set<Element> elements)
Sorts the given subset element list using the current settings.

Parameters:
elements - the subset element
Returns:
the sorted element hierarchy

filter

public final void filter(java.util.List<ElementNode> hierarchy,
                         java.util.Set<Element> elements)
Description copied from interface: StructuralFilter
Filters the given element hierarchy represented by ElementNodes. The given list contains only the root nodes. The second parameter contains all currently used elements.

Specified by:
filter in interface StructuralFilter
elements - the currently used Elements

getType

public final int getType()
Description copied from interface: SubsetFilter
Returns the filter type which is one of the defined type constants.

Specified by:
getType in interface SubsetFilter
Returns:
the filter type

initialize

public final void initialize()
Description copied from interface: SubsetFilter
Initializes this filter.

Specified by:
initialize in interface SubsetFilter

validateSettings

public final void validateSettings()
                            throws PaloIOException
Description copied from interface: SubsetFilter
Checks if the internal subset settings are valid.

Specified by:
validateSettings in interface SubsetFilter
Throws:
PaloIOException - if internal subset settings are not valid.

add

public final void add(EffectiveFilter filter)
Description copied from interface: SubsetFilter
Adds the given EffectiveFilter to the list of all affective filters which affect this subset filter

Specified by:
add in interface SubsetFilter
Parameters:
filter - a filter which affects this subset filter.

remove

public final void remove(EffectiveFilter filter)
Description copied from interface: SubsetFilter
Removes the given EffectiveFilter from the list of all affective filters which affect this subset filter

Specified by:
remove in interface SubsetFilter
Parameters:
filter - the affective filter to remove

reset

public final void reset()
Description copied from interface: SubsetFilter
Resets this filter, i.e. its internal setting is switched back to its default. Clears all internal used caches too.

Specified by:
reset in interface SubsetFilter

getSubset

public final Subset2 getSubset()
Description copied from interface: SubsetFilter
Returns the Subset2 to which this filter belongs or null if this filter isn't bind to a subset yet.

Specified by:
getSubset in interface SubsetFilter
Returns:
the Subset2 to which this filter belongs or null

bind

public final void bind(Subset2 subset)
Description copied from interface: SubsetFilter

Binds this filter instance to the given Subset2

NOTE: PLEASE DON'T USE! INTERNAL METHOD

Specified by:
bind in interface SubsetFilter

unbind

public final void unbind()
Description copied from interface: SubsetFilter

Releases this filter instance from a previously binded Subset2

NOTE: PLEASE DON'T USE! INTERNAL METHOD

Specified by:
unbind in interface SubsetFilter

getDimension

public final Dimension getDimension()

getHierarchy

public final Hierarchy getHierarchy()
Description copied from interface: SubsetFilter
Convenient method to access the subset hierarchy.

Specified by:
getHierarchy in interface SubsetFilter
Returns:
the subset hierarchy

adapt

public final void adapt(SubsetFilter from)
Description copied from interface: SubsetFilter
Adapts this subset filter from the given one. Both filter must be of same type!

Specified by:
adapt in interface SubsetFilter
Parameters:
from - the subset filter to adapt from