de.lmu.ifi.dbs.elki.database.relation
Class MaterializedRelation<O>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.result.AbstractHierarchicalResult
      extended by de.lmu.ifi.dbs.elki.database.relation.MaterializedRelation<O>
Type Parameters:
O - Data type
All Implemented Interfaces:
DatabaseQuery, Relation<O>, HierarchicalResult, Result

public class MaterializedRelation<O>
extends AbstractHierarchicalResult
implements Relation<O>

Represents a single representation. This is attached to a DBIDs object, which you are supposed to manage first. I.e. put the new DBID in, then invoke set(), remove the DBID, then delete(). TODO: is this semantic sane?


Field Summary
private  DataStore<O> content
          Map to hold the objects of the database.
private  Database database
          Our database
private  StaticDBIDs ids
          The DBIDs this is supposed to be defined for.
private  String name
          The relation name.
private  String shortname
          The relation name (short version)
private  SimpleTypeInformation<O> type
          The class of objects we store.
 
Fields inherited from interface de.lmu.ifi.dbs.elki.database.query.DatabaseQuery
HINT_BULK, HINT_EXACT, HINT_HEAVY_USE, HINT_NO_CACHE, HINT_OPTIMIZED_ONLY, HINT_SINGLE
 
Constructor Summary
MaterializedRelation(Database database, SimpleTypeInformation<O> type, DBIDs ids)
          Constructor.
MaterializedRelation(Database database, SimpleTypeInformation<O> type, DBIDs ids, String name)
          Constructor.
MaterializedRelation(Database database, SimpleTypeInformation<O> type, DBIDs ids, String name, DataStore<O> content)
          Constructor.
MaterializedRelation(String name, String shortname, SimpleTypeInformation<O> type, DataStore<O> content, DBIDs ids)
          Constructor.
 
Method Summary
 void delete(DBID id)
          Delete an objects values.
 O get(DBID id)
          Get the representation of an object.
 Database getDatabase()
          Get the associated database.
 SimpleTypeInformation<O> getDataTypeInformation()
          Get the data type of this representation
 StaticDBIDs getDBIDs()
          Get the IDs the query is defined for.
 String getLongName()
          A "pretty" name for the result, for use in titles, captions and menus.
 String getShortName()
          A short name for the result, useful for file names.
 IterableIterator<DBID> iterDBIDs()
          Get an iterator access to the DBIDs.
 void set(DBID id, O val)
          Set an object representation.
 int size()
          Get the number of DBIDs.
 
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.HierarchicalResult
getHierarchy, setHierarchy
 

Field Detail

database

private final Database database
Our database


type

private final SimpleTypeInformation<O> type
The class of objects we store.


content

private final DataStore<O> content
Map to hold the objects of the database.


ids

private final StaticDBIDs ids
The DBIDs this is supposed to be defined for. Note: we only keep an unmodifiable reference.


name

private String name
The relation name.


shortname

private String shortname
The relation name (short version)

Constructor Detail

MaterializedRelation

public MaterializedRelation(Database database,
                            SimpleTypeInformation<O> type,
                            DBIDs ids)
Constructor.

Parameters:
database - Database
type - Type information
ids - IDs

MaterializedRelation

public MaterializedRelation(Database database,
                            SimpleTypeInformation<O> type,
                            DBIDs ids,
                            String name)
Constructor.

Parameters:
database - Database
type - Type information
ids - IDs
name - Name

MaterializedRelation

public MaterializedRelation(Database database,
                            SimpleTypeInformation<O> type,
                            DBIDs ids,
                            String name,
                            DataStore<O> content)
Constructor.

Parameters:
database - Database
type - Type information
ids - IDs
name - Name
content - Content

MaterializedRelation

public MaterializedRelation(String name,
                            String shortname,
                            SimpleTypeInformation<O> type,
                            DataStore<O> content,
                            DBIDs ids)
Constructor.

Parameters:
name - Name
shortname - Short name of the result
type - Type information
content - Content
ids - IDs
Method Detail

getDatabase

public Database getDatabase()
Description copied from interface: Relation
Get the associated database. Note: in some situations, this might be null!

Specified by:
getDatabase in interface Relation<O>
Returns:
Database

get

public O get(DBID id)
Description copied from interface: Relation
Get the representation of an object.

Specified by:
get in interface Relation<O>
Parameters:
id - Object ID
Returns:
object instance

set

public void set(DBID id,
                O val)
Description copied from interface: Relation
Set an object representation.

Specified by:
set in interface Relation<O>
Parameters:
id - Object ID
val - Value

delete

public void delete(DBID id)
Delete an objects values.

Specified by:
delete in interface Relation<O>
Parameters:
id - ID to delete

getDBIDs

public StaticDBIDs getDBIDs()
Description copied from interface: Relation
Get the IDs the query is defined for.

Specified by:
getDBIDs in interface Relation<O>
Returns:
IDs this is defined for

iterDBIDs

public IterableIterator<DBID> iterDBIDs()
Description copied from interface: Relation
Get an iterator access to the DBIDs.

Specified by:
iterDBIDs in interface Relation<O>
Returns:
iterator for the DBIDs.

size

public int size()
Description copied from interface: Relation
Get the number of DBIDs.

Specified by:
size in interface Relation<O>
Returns:
Size

getDataTypeInformation

public SimpleTypeInformation<O> getDataTypeInformation()
Description copied from interface: Relation
Get the data type of this representation

Specified by:
getDataTypeInformation in interface Relation<O>
Returns:
Data type

getLongName

public String getLongName()
Description copied from interface: Result
A "pretty" name for the result, for use in titles, captions and menus.

Specified by:
getLongName in interface Result
Returns:
result name

getShortName

public String getShortName()
Description copied from interface: Result
A short name for the result, useful for file names.

Specified by:
getShortName in interface Result
Returns:
result name

Release 0.4.0 (2011-09-20_1324)