Class IntegerDBIDKNNSubList

    • Field Detail

      • k

        private final int k
        Parameter k.
      • size

        private final int size
        Actual size, including ties.
    • Constructor Detail

      • IntegerDBIDKNNSubList

        public IntegerDBIDKNNSubList​(DoubleIntegerDBIDKNNList inner,
                                     int k)
        Constructor.
        Parameters:
        inner - Inner instance
        k - k value
    • Method Detail

      • getK

        public int getK()
        Description copied from interface: KNNList
        Get the K parameter (note: this may be less than the size of the list!)
        Specified by:
        getK in interface KNNList
        Returns:
        K
      • assignVar

        public DBIDVar assignVar​(int index,
                                 DBIDVar var)
        Description copied from interface: DoubleDBIDList
        Assign a DBID variable the value of position index.
        Specified by:
        assignVar in interface DoubleDBIDList
        Parameters:
        index - Position
        var - Variable to assign the value to.
      • getKNNDistance

        public double getKNNDistance()
        Description copied from interface: KNNList
        Get the distance to the k nearest neighbor, or infinity otherwise.
        Specified by:
        getKNNDistance in interface KNNList
        Returns:
        Maximum distance
      • iter

        public IntegerDBIDKNNSubList.Itr iter()
        Description copied from interface: DBIDs
        Get a DBID iterator (a more efficient API).

        Example:

         
         for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
           NumberVector vec = relation.get(iter); // iter is a temporary object reference
         }
         
         
        Specified by:
        iter in interface DBIDs
        Specified by:
        iter in interface DoubleDBIDList
        Specified by:
        iter in interface DoubleIntegerDBIDList
        Specified by:
        iter in interface IntegerDBIDs
        Returns:
        iterator
      • contains

        public boolean contains​(DBIDRef o)
        Description copied from interface: DBIDs
        Test whether an ID is contained.
        Specified by:
        contains in interface DBIDs
        Parameters:
        o - object to test
        Returns:
        true when contained
      • size

        public int size()
        Description copied from interface: DBIDs
        Retrieve the collection / data size.
        Specified by:
        size in interface DBIDs
        Specified by:
        size in interface DoubleDBIDList
        Returns:
        collection size
      • subList

        public KNNList subList​(int k)
        Description copied from interface: KNNList
        Select a subset for a smaller k.
        Specified by:
        subList in interface KNNList
        Parameters:
        k - New k
        Returns:
        KNN result for the smaller k.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • map

        public KNNList map​(java.util.function.DoubleUnaryOperator f)
        Description copied from interface: KNNList
        Function to project the knn list.
        Specified by:
        map in interface KNNList
        Parameters:
        f - Function to transform values
        Returns:
        projected list