Class ProjectedView<IN,​OUT>

  • Type Parameters:
    IN - Vector type
    OUT - Vector type
    All Implemented Interfaces:
    Relation<OUT>

    public class ProjectedView<IN,​OUT>
    extends java.lang.Object
    implements Relation<OUT>
    Projected relation view (non-materialized)
    Since:
    0.5.0
    Author:
    Erich Schubert
    • Field Detail

      • inner

        private final Relation<? extends IN> inner
        The wrapped representation where we get the IDs from.
      • projection

        private Projection<IN,​OUT> projection
        The projection we use.
    • Constructor Detail

      • ProjectedView

        public ProjectedView​(Relation<? extends IN> inner,
                             Projection<IN,​OUT> projection)
        Constructor.
        Parameters:
        inner - Inner relation
        projection - Projection function
    • Method Detail

      • 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<IN>
        Returns:
        Relation name
      • get

        public OUT get​(DBIDRef id)
        Description copied from interface: Relation
        Get the representation of an object.
        Specified by:
        get in interface Relation<IN>
        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<IN>
        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<IN>
        Returns:
        Size