Class ConvertToStringView

  • All Implemented Interfaces:
    Relation<java.lang.String>

    public class ConvertToStringView
    extends java.lang.Object
    implements Relation<java.lang.String>
    Representation adapter that uses toString() to produce a string representation.
    Since:
    0.4.0
    Author:
    Erich Schubert
    • Field Detail

      • existing

        final Relation<?> existing
        The database we use
    • Constructor Detail

      • ConvertToStringView

        public ConvertToStringView​(Relation<?> existing)
        Constructor.
        Parameters:
        existing - Existing representation
    • Method Detail

      • get

        public java.lang.String get​(DBIDRef id)
        Description copied from interface: Relation
        Get the representation of an object.
        Specified by:
        get in interface Relation<java.lang.String>
        Parameters:
        id - Object ID
        Returns:
        object instance
      • getDBIDs

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

        If possible, prefer Relation.iterDBIDs().

        Specified by:
        getDBIDs in interface Relation<java.lang.String>
        Returns:
        IDs this is defined for
      • 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.String>
        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.String>
        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.String>
        Returns:
        Relation name