it.tidalwave.util
Class DefaultFilterSortCriterion<Type>

Package class diagram package DefaultFilterSortCriterion
java.lang.Object
  extended by it.tidalwave.util.DefaultFilterSortCriterion<Type>
All Implemented Interfaces:
Finder.FilterSortCriterion<Type>, Finder.SortCriterion, Serializable

public class DefaultFilterSortCriterion<Type>
extends Object
implements Finder.FilterSortCriterion<Type>, Serializable

A default implementation of Finder.FilterSortCriterion which relies on sorting capabilities of the Java runtime library and only needs a Comparator to be specified.

Version:
$Id$
Author:
Fabrizio Giudici
See Also:
Serialized Form
Status: draft API

Field Summary
 
Fields inherited from interface it.tidalwave.util.Finder.SortCriterion
DEFAULT, SortCriterion, UNSORTED
 
Constructor Summary
protected DefaultFilterSortCriterion(Comparator<? super Type> comparator)
          Creates an instance that will use the given Comparator.
  DefaultFilterSortCriterion(Comparator<? super Type> comparator, String name)
          Creates an instance that will use the given Comparator, with the given name (used for diagnostics).
 
Method Summary
 void sort(List<? extends Type> results, Finder.SortDirection sortDirection)
          Performs the sort of results.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultFilterSortCriterion

public DefaultFilterSortCriterion(@Nonnull
                                  Comparator<? super Type> comparator,
                                  @Nonnull
                                  String name)
Creates an instance that will use the given Comparator, with the given name (used for diagnostics).

Parameters:
comparator - the comparator
name - a name used for diagnostics

DefaultFilterSortCriterion

protected DefaultFilterSortCriterion(@Nonnull
                                     Comparator<? super Type> comparator)
Creates an instance that will use the given Comparator.

Parameters:
comparator - the comparator
Method Detail

sort

@Nonnull
public void sort(@Nonnull
                         List<? extends Type> results,
                         @Nonnull
                         Finder.SortDirection sortDirection)
Performs the sort of results.

Specified by:
sort in interface Finder.FilterSortCriterion<Type>
Parameters:
results - the list of objects to be sorted in place
sortDirection - the sort direction

toString

@Nonnull
public String toString()

Overrides:
toString in class Object


Copyright © 2009-2012 Tidalwave s.a.s.. All Rights Reserved.