Class MaterializedRelation<O>

  • Type Parameters:
    O - Data type
    All Implemented Interfaces:
    ModifiableRelation<O>, Relation<O>

    public class MaterializedRelation<O>
    extends java.lang.Object
    implements ModifiableRelation<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?

    Since:
    0.4.0
    Author:
    Erich Schubert
    • Field Detail

      • 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 java.lang.String name
        The relation name.
    • Constructor Detail

      • MaterializedRelation

        public MaterializedRelation​(SimpleTypeInformation<O> type,
                                    DBIDs ids)
        Constructor.
        Parameters:
        type - Type information
        ids - IDs
      • MaterializedRelation

        public MaterializedRelation​(java.lang.String name,
                                    SimpleTypeInformation<O> type,
                                    DBIDs ids)
        Constructor.
        Parameters:
        name - Name
        type - Type information
        ids - IDs
      • MaterializedRelation

        public MaterializedRelation​(java.lang.String name,
                                    SimpleTypeInformation<O> type,
                                    DBIDs ids,
                                    DataStore<O> content)
        Constructor.
        Parameters:
        name - Name
        type - Type information
        ids - IDs
        content - Content
    • Method Detail

      • get

        public O get​(DBIDRef 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
      • iterDBIDs

        public DBIDIter iterDBIDs()
        Description copied from interface: Relation
        Get an iterator access to the DBIDs.

        To iterate over all IDs, use the following code fragment:

         
         for(DBIDIter iter = relation.iterDBIDs(); iter.valid(); iter.advance()) {
            relation.get(iter); // Get the current element
         }
         
         
        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
      • getLongName

        public java.lang.String getLongName()
        Description copied from interface: Relation
        Get a long (human readable) name for the relation.
        Specified by:
        getLongName in interface Relation<O>
        Returns:
        Relation name