de.lmu.ifi.dbs.elki.result
Class OrderingFromDataStore<T extends Comparable<T>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.result.AbstractHierarchicalResult
      extended by de.lmu.ifi.dbs.elki.result.BasicResult
          extended by de.lmu.ifi.dbs.elki.result.OrderingFromDataStore<T>
Type Parameters:
T - Data type in hash map
All Implemented Interfaces:
HierarchicalResult, OrderingResult, Result

public class OrderingFromDataStore<T extends Comparable<T>>
extends BasicResult
implements OrderingResult

Result class providing an ordering backed by a hashmap.


Nested Class Summary
protected  class OrderingFromDataStore.DerivedComparator
          Internal comparator, accessing the map but then using the provided comparator to sort objects
protected  class OrderingFromDataStore.ImpliedComparator
          Internal comparator, accessing the map to sort objects
 
Field Summary
(package private)  int ascending
          Factor for ascending (+1) and descending (-1) ordering.
protected  Comparator<T> comparator
          Comparator to use when sorting
protected  DBIDs ids
          Database IDs
protected  DataStore<? extends T> map
          HashMap with object values
 
Constructor Summary
OrderingFromDataStore(String name, String shortname, DBIDs ids, DataStore<? extends T> map)
          Minimal Constructor
OrderingFromDataStore(String name, String shortname, DBIDs ids, DataStore<? extends T> map, boolean descending)
          Constructor without comparator
OrderingFromDataStore(String name, String shortname, DBIDs ids, DataStore<? extends T> map, Comparator<T> comparator, boolean descending)
          Constructor with comparator
 
Method Summary
 DBIDs getDBIDs()
          Get the full set of DBIDs this ordering is defined for.
 IterableIterator<DBID> iter(DBIDs ids)
          Sort the given ids according to this ordering and return an iterator.
 
Methods inherited from class de.lmu.ifi.dbs.elki.result.BasicResult
getLongName, getShortName
 
Methods inherited from class de.lmu.ifi.dbs.elki.result.AbstractHierarchicalResult
addChildResult, getHierarchy, setHierarchy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.result.Result
getLongName, getShortName
 

Field Detail

map

protected DataStore<? extends T extends Comparable<T>> map
HashMap with object values


ids

protected DBIDs ids
Database IDs


comparator

protected Comparator<T extends Comparable<T>> comparator
Comparator to use when sorting


ascending

int ascending
Factor for ascending (+1) and descending (-1) ordering.

Constructor Detail

OrderingFromDataStore

public OrderingFromDataStore(String name,
                             String shortname,
                             DBIDs ids,
                             DataStore<? extends T> map,
                             Comparator<T> comparator,
                             boolean descending)
Constructor with comparator

Parameters:
name - The long name (for pretty printing)
shortname - the short name (for filenames etc.)
ids - DBIDs included
map - data hash map
comparator - comparator to use, may be null
descending - ascending (false) or descending (true) order.

OrderingFromDataStore

public OrderingFromDataStore(String name,
                             String shortname,
                             DBIDs ids,
                             DataStore<? extends T> map,
                             boolean descending)
Constructor without comparator

Parameters:
name - The long name (for pretty printing)
shortname - the short name (for filenames etc.)
ids - DBIDs included
map - data hash map
descending - ascending (false) or descending (true) order.

OrderingFromDataStore

public OrderingFromDataStore(String name,
                             String shortname,
                             DBIDs ids,
                             DataStore<? extends T> map)
Minimal Constructor

Parameters:
name - The long name (for pretty printing)
shortname - the short name (for filenames etc.)
ids - DBIDs included
map - data hash map
Method Detail

getDBIDs

public DBIDs getDBIDs()
Description copied from interface: OrderingResult
Get the full set of DBIDs this ordering is defined for.

Specified by:
getDBIDs in interface OrderingResult
Returns:
DBIDs

iter

public IterableIterator<DBID> iter(DBIDs ids)
Description copied from interface: OrderingResult
Sort the given ids according to this ordering and return an iterator.

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

Release 0.4.0 (2011-09-20_1324)