se.kmr.scam.client.http.util
Class Sorter

java.lang.Object
  extended byse.kmr.scam.client.http.util.Sorter

public abstract class Sorter
extends Object

This object sorts a set of key objects and a set of value objects with respect to the key value. The key objects is associated to the value objects by index.

NOTE: The given sets are both kept unaltered. The sorted set key objects is retrived with getKeys() and the sorted value object is retrived with getValues()

Version:
$Revision: 1.8 $
Author:
Jöran
Created:
den 16 juli 2002

Field Summary
static Sorter ASCENDINGORDER
           
static String ASCENDINGORDER_NAME
           
static Sorter DESCENDINGORDER
           
static String DESCENDINGORDER_NAME
           
static Sorter UNORDERD
           
static String UNORDERD_NAME
           
 
Method Summary
 List getKeys()
          Gets the keys attribute of the Sorter object
 String getName()
          Gets the name attribute of the Sorter object
static Sorter getSorterByName(String aSortOrder)
          Gets a Sorter object associated to a name
 List getValues()
          Gets the values attribute of the Sorter object
abstract  boolean needsSwap(Object first, Object scnd)
           
 void setKeys(Collection keys)
          Sets a collection key objects.
 void setValues(Collection values)
          Sets a collection of value objects
 boolean sort()
          Sorts value- and key-objects.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNORDERD_NAME

public static final String UNORDERD_NAME
See Also:
Constant Field Values

ASCENDINGORDER_NAME

public static final String ASCENDINGORDER_NAME
See Also:
Constant Field Values

DESCENDINGORDER_NAME

public static final String DESCENDINGORDER_NAME
See Also:
Constant Field Values

UNORDERD

public static final Sorter UNORDERD

DESCENDINGORDER

public static final Sorter DESCENDINGORDER

ASCENDINGORDER

public static final Sorter ASCENDINGORDER
Method Detail

getSorterByName

public static Sorter getSorterByName(String aSortOrder)
Gets a Sorter object associated to a name

Parameters:
aSortOrder - name of the Sorter
Returns:
the Sorter object

setKeys

public void setKeys(Collection keys)
Sets a collection key objects.

Parameters:
keys - The new keys value

setValues

public void setValues(Collection values)
Sets a collection of value objects

Parameters:
values - The new values value

getKeys

public List getKeys()
Gets the keys attribute of the Sorter object

Returns:
The keys value

getValues

public List getValues()
Gets the values attribute of the Sorter object

Returns:
The values value

getName

public String getName()
Gets the name attribute of the Sorter object

Returns:
the name

sort

public boolean sort()
Sorts value- and key-objects.

Returns:
TRUE iff the sorting algorithm succeeds in ordering all elements, else FALSE.

toString

public String toString()

needsSwap

public abstract boolean needsSwap(Object first,
                                  Object scnd)


Copyright © 2003 SCAM. All Rights Reserved.