diff options
Diffstat (limited to 'src/de/lmu/ifi/dbs/elki/database/relation/Relation.java')
-rw-r--r-- | src/de/lmu/ifi/dbs/elki/database/relation/Relation.java | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/de/lmu/ifi/dbs/elki/database/relation/Relation.java b/src/de/lmu/ifi/dbs/elki/database/relation/Relation.java index ebe1be3c..4969ad50 100644 --- a/src/de/lmu/ifi/dbs/elki/database/relation/Relation.java +++ b/src/de/lmu/ifi/dbs/elki/database/relation/Relation.java @@ -25,17 +25,19 @@ package de.lmu.ifi.dbs.elki.database.relation; import de.lmu.ifi.dbs.elki.data.type.SimpleTypeInformation; import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.database.ids.DBID; +import de.lmu.ifi.dbs.elki.database.ids.DBIDIter; +import de.lmu.ifi.dbs.elki.database.ids.DBIDRef; import de.lmu.ifi.dbs.elki.database.ids.DBIDs; import de.lmu.ifi.dbs.elki.database.query.DatabaseQuery; import de.lmu.ifi.dbs.elki.result.HierarchicalResult; -import de.lmu.ifi.dbs.elki.utilities.iterator.IterableIterator; /** * An object representation from a database * * @author Erich Schubert - * + * + * @apiviz.uses DBIDRef + * * @param <O> Object type */ public interface Relation<O> extends DatabaseQuery, HierarchicalResult { @@ -47,15 +49,15 @@ public interface Relation<O> extends DatabaseQuery, HierarchicalResult { * @return Database */ public Database getDatabase(); - + /** * Get the representation of an object. * * @param id Object ID * @return object instance */ - public O get(DBID id); - + public O get(DBIDRef id); + /** * Set an object representation. * @@ -63,14 +65,14 @@ public interface Relation<O> extends DatabaseQuery, HierarchicalResult { * @param val Value */ // TODO: remove / move to a writable API? - public void set(DBID id, O val); + public void set(DBIDRef id, O val); /** * Delete an objects values. * * @param id ID to delete */ - public void delete(DBID id); + public void delete(DBIDRef id); /** * Get the data type of this representation @@ -78,7 +80,7 @@ public interface Relation<O> extends DatabaseQuery, HierarchicalResult { * @return Data type */ public SimpleTypeInformation<O> getDataTypeInformation(); - + /** * Get the IDs the query is defined for. * @@ -89,9 +91,19 @@ public interface Relation<O> extends DatabaseQuery, HierarchicalResult { /** * Get an iterator access to the DBIDs. * + * To iterate over all IDs, use the following code fragment: + * + * <pre> + * {@code + * for(DBIDIter iter = relation.iterDBIDs(); iter.valid(); iter.advance()) { + * DBID id = iter.getDBID(); + * } + * } + * </pre> + * * @return iterator for the DBIDs. */ - public IterableIterator<DBID> iterDBIDs(); + public DBIDIter iterDBIDs(); /** * Get the number of DBIDs. |