Class MaterializedDoubleRelation

  • All Implemented Interfaces:
    DoubleRelation, ModifiableRelation<java.lang.Double>, Relation<java.lang.Double>

    public class MaterializedDoubleRelation
    extends java.lang.Object
    implements DoubleRelation
    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().
    Since:
    0.4.0
    Author:
    Erich Schubert
    • Field Detail

      • content

        private final DoubleDataStore 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

      • MaterializedDoubleRelation

        public MaterializedDoubleRelation​(java.lang.String name,
                                          DBIDs ids)
        Constructor.
        Parameters:
        name - Name
        ids - IDs
      • MaterializedDoubleRelation

        public MaterializedDoubleRelation​(java.lang.String name,
                                          DBIDs ids,
                                          DoubleDataStore content)
        Constructor.
        Parameters:
        name - Name
        ids - IDs
        content - Content
    • Method Detail

      • doubleValue

        public double doubleValue​(DBIDRef id)
        Description copied from interface: DoubleRelation
        Get the representation of an object.
        Specified by:
        doubleValue in interface DoubleRelation
        Parameters:
        id - Object ID
        Returns:
        object instance
      • set

        public void set​(DBIDRef id,
                        double val)
        Description copied from interface: DoubleRelation
        Set an object representation.
        Specified by:
        set in interface DoubleRelation
        Parameters:
        id - Object ID
        val - Value
      • insert

        @Deprecated
        public void insert​(DBIDRef id,
                           java.lang.Double val)
        Deprecated.
        Description copied from interface: ModifiableRelation
        Set (or insert) an object representation.
        Specified by:
        insert in interface DoubleRelation
        Specified by:
        insert in interface ModifiableRelation<java.lang.Double>
        Parameters:
        id - Object ID
        val - Value
      • delete

        public void delete​(DBIDRef id)
        Delete an objects values.
        Specified by:
        delete in interface ModifiableRelation<java.lang.Double>
        Parameters:
        id - ID to delete
      • 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<java.lang.Double>
        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<java.lang.Double>
        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<java.lang.Double>
        Returns:
        Relation name