Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.result
Class OrderingFromAssociation<T extends Comparable<T>,O extends DatabaseObject>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.result.OrderingFromAssociation<T,O>
Type Parameters:
T - data type of annotation.
O - database object type
All Implemented Interfaces:
OrderingResult, Result

public class OrderingFromAssociation<T extends Comparable<T>,O extends DatabaseObject>
extends Object
implements OrderingResult

Return an ordering result backed by a database. Note that the implementation will sort with O(n lg n) database accesses on average, O(n*n) in worst case to avoid having to store all objects in memory.

Author:
Erich Schubert

Nested Class Summary
protected  class OrderingFromAssociation.DerivedComparator
          Internally used comparator using a preexisting comparator for the given datatype
protected  class OrderingFromAssociation.ImpliedComparator
          Internally used comparator retrieving data from the database.
 
Field Summary
(package private)  int ascending
          Factor to signal ascending (+1) / descending (-1) order
protected  AssociationID<T> association
          AssocationID to use
protected  Comparator<T> comparator
          Internal comparator to use for sorting.
protected  Database<O> db
          Database
 
Constructor Summary
OrderingFromAssociation(Database<O> db, AssociationID<T> association)
          Deprecated. 
OrderingFromAssociation(Database<O> db, AssociationID<T> association, boolean descending)
          Deprecated. 
OrderingFromAssociation(Database<O> db, AssociationID<T> association, Comparator<T> comparator, boolean descending)
          Deprecated. 
 
Method Summary
 String getName()
          Get a user-understandable name for this result.
 IterableIterator<Integer> iter(Collection<Integer> ids)
          Sort the given collection of IDs and return an iterator for the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

db

protected Database<O extends DatabaseObject> db
Database


association

protected AssociationID<T extends Comparable<T>> association
AssocationID to use


comparator

protected Comparator<T extends Comparable<T>> comparator
Internal comparator to use for sorting.


ascending

int ascending
Factor to signal ascending (+1) / descending (-1) order

Constructor Detail

OrderingFromAssociation

@Deprecated
public OrderingFromAssociation(Database<O> db,
                                          AssociationID<T> association,
                                          Comparator<T> comparator,
                                          boolean descending)
Deprecated. 

Full Constructor (with comparator)

Parameters:
db - Database
association - AssociationID to use
comparator - Comparator for data type used by association
descending - boolean to mark descending ordering (true)

OrderingFromAssociation

@Deprecated
public OrderingFromAssociation(Database<O> db,
                                          AssociationID<T> association,
                                          boolean descending)
Deprecated. 

Constructor without comparator

Parameters:
db - Database
association - AssociationID to use
descending - boolean to mark descending ordering (true)

OrderingFromAssociation

@Deprecated
public OrderingFromAssociation(Database<O> db,
                                          AssociationID<T> association)
Deprecated. 

Minimal constructor, using implied comparator and ascending order.

Parameters:
db - Database
association - AssociationID to use
Method Detail

iter

public IterableIterator<Integer> iter(Collection<Integer> ids)
Sort the given collection of IDs and return an iterator for the result.

Specified by:
iter in interface OrderingResult
Parameters:
ids - Collection of ids.
Returns:
iterator for sorted array of ids

getName

public String getName()
Description copied from interface: Result
Get a user-understandable name for this result. Defaults may be returned such as "list" for a list result.

Specified by:
getName in interface Result
Returns:
result name

Release 0.3 (2010-03-31_1612)