Class IntegerDBIDRange

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  IntegerDBIDRange.Itr
      Iterator in ELKI/C++ style.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int len
      Length value.
      protected int start
      Start value.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected IntegerDBIDRange​(int start, int len)
      Constructor.
    • Field Detail

      • start

        protected final int start
        Start value.
      • len

        protected final int len
        Length value.
    • Constructor Detail

      • IntegerDBIDRange

        protected IntegerDBIDRange​(int start,
                                   int len)
        Constructor.
        Parameters:
        start - Range start
        len - Range length
    • Method Detail

      • size

        public int size()
        Description copied from interface: DBIDs
        Retrieve the collection / data size.
        Specified by:
        size in interface ArrayDBIDs
        Specified by:
        size in interface DBIDs
        Returns:
        collection size
      • 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
      • getOffset

        public int getOffset​(DBIDRef dbid)
        For storage array offsets.
        Specified by:
        getOffset in interface DBIDRange
        Parameters:
        dbid - ID reference
        Returns:
        array offset
      • assignVar

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

        public int binarySearch​(DBIDRef key)
        Description copied from interface: ArrayDBIDs
        Search for the position of the given key, assuming that the data set is sorted. For unsorted arrays, the result is undefined.

        For keys not found, -(1+insertion position) is returned, as for Java Collections.binarySearch(java.util.List<? extends java.lang.Comparable<? super T>>, T)

        Specified by:
        binarySearch in interface ArrayDBIDs
        Parameters:
        key - Key to search for
        Returns:
        Offset of key
      • toString

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

        public int mapDBIDToOffset​(DBIDRef dbid)
        Description copied from interface: DataStoreIDMap
        Map a DBID to an array offset.
        Specified by:
        mapDBIDToOffset in interface DataStoreIDMap
        Parameters:
        dbid - DBID
        Returns:
        record id id >= 0
      • slice

        public ArrayDBIDs slice​(int begin,
                                int end)
        Description copied from interface: ArrayDBIDs
        Slice a subarray (as view, not copy!)
        Specified by:
        slice in interface ArrayDBIDs
        Parameters:
        begin - Begin (inclusive)
        end - End (exclusive)
        Returns:
        Array slice.
      • iter

        public IntegerDBIDRange.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 ArrayDBIDs
        Specified by:
        iter in interface DBIDs
        Specified by:
        iter in interface IntegerDBIDs
        Returns:
        iterator