Class IntegerDBIDPair.Slice

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) int begin
      Slice positions.
      (package private) int end
      Slice positions.
    • Constructor Summary

      Constructors 
      Constructor Description
      Slice​(int begin, int end)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      DBIDVar assignVar​(int index, DBIDVar var)
      Assign a DBID variable the value of position index.
      int binarySearch​(DBIDRef key)
      Search for the position of the given key, assuming that the data set is sorted.
      boolean contains​(DBIDRef o)
      Test whether an ID is contained.
      DBID get​(int i)
      Get the i'th entry (starting at 0)
      boolean isEmpty()
      Test for an empty DBID collection.
      IntegerDBIDArrayIter iter()
      Get a DBID iterator (a more efficient API).
      int size()
      Retrieve the collection / data size.
      IntegerDBIDPair.Slice slice​(int begin, int end)
      Slice a subarray (as view, not copy!)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface elki.database.ids.DBIDs

        forEach
    • Field Detail

      • begin

        final int begin
        Slice positions.
      • end

        final int end
        Slice positions.
    • Constructor Detail

      • Slice

        public Slice​(int begin,
                     int end)
        Constructor.
        Parameters:
        begin - Begin, inclusive
        end - End, exclusive
    • 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
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: DBIDs
        Test for an empty DBID collection.
        Specified by:
        isEmpty in interface DBIDs
        Returns:
        true when empty.
      • 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
      • iter

        public IntegerDBIDArrayIter 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 IntegerArrayDBIDs
        Specified by:
        iter in interface IntegerDBIDs
        Returns:
        iterator