Interface DBIDFactory

    • Field Detail

      • FACTORY

        static final DBIDFactory FACTORY
        Static DBID factory to use.
    • Method Detail

      • newVar

        DBIDVar newVar​(DBIDRef val)
        Make a new DBID variable.
        Parameters:
        val - Initial value.
        Returns:
        Variable
      • importInteger

        DBID importInteger​(int id)
        Import and integer as DBID.

        Note: this may not be possible for some factories that are not int-based!

        Parameters:
        id - Integer ID to import
        Returns:
        DBID
      • assignVar

        DBIDVar assignVar​(DBIDVar var,
                          int val)
        Assign an integer value to a DBID variable.

        Note: this may not be possible for some factories that are not int-based!

        Parameters:
        var - Variable
        val - Integer value
      • generateSingleDBID

        DBID generateSingleDBID()
        Generate a single DBID.
        Returns:
        A single DBID
      • deallocateSingleDBID

        void deallocateSingleDBID​(DBIDRef id)
        Return a single DBID for reuse.
        Parameters:
        id - DBID to deallocate
      • generateStaticDBIDRange

        DBIDRange generateStaticDBIDRange​(int size)
        Generate a static DBID range.
        Parameters:
        size - Requested size
        Returns:
        DBID range
      • generateStaticDBIDRange

        DBIDRange generateStaticDBIDRange​(int begin,
                                          int size)
        Generate a static DBID range.
        Parameters:
        begin - Range begin
        size - Requested size
        Returns:
        DBID range
      • deallocateDBIDRange

        void deallocateDBIDRange​(DBIDRange range)
        Deallocate a static DBID range.
        Parameters:
        range - Range to deallocate
      • newPair

        DBIDPair newPair​(DBIDRef id1,
                         DBIDRef id2)
        Make a DBID pair from two existing DBIDs.
        Parameters:
        id1 - first DBID
        id2 - second DBID
        Returns:
        new pair.
      • newPair

        DoubleDBIDPair newPair​(double val,
                               DBIDRef id)
        Make a double-DBID pair.
        Parameters:
        val - Double value
        id - DBID
        Returns:
        New pair
      • newArray

        ArrayModifiableDBIDs newArray()
        Make a new (modifiable) array of DBIDs.
        Returns:
        New array
      • newHashSet

        HashSetModifiableDBIDs newHashSet()
        Make a new (modifiable) hash set of DBIDs.
        Returns:
        New hash set
      • newArray

        ArrayModifiableDBIDs newArray​(int size)
        Make a new (modifiable) array of DBIDs.
        Parameters:
        size - Size hint
        Returns:
        New array
      • newHashSet

        HashSetModifiableDBIDs newHashSet​(int size)
        Make a new (modifiable) hash set of DBIDs.
        Parameters:
        size - Size hint
        Returns:
        New hash set
      • newArray

        ArrayModifiableDBIDs newArray​(DBIDs existing)
        Make a new (modifiable) array of DBIDs.
        Parameters:
        existing - existing DBIDs to use
        Returns:
        New array
      • newHashSet

        HashSetModifiableDBIDs newHashSet​(DBIDs existing)
        Make a new (modifiable) hash set of DBIDs.
        Parameters:
        existing - existing DBIDs to use
        Returns:
        New hash set
      • newMinHeap

        DoubleDBIDHeap newMinHeap​(int k)
        Create a min heap.
        Parameters:
        k - Design sign
        Returns:
        New heap of size k.
      • newMaxHeap

        DoubleDBIDHeap newMaxHeap​(int k)
        Create a max heap (see also newHeap(int) for a kNN heap).
        Parameters:
        k - Design sign
        Returns:
        New heap of size k.
      • newHeap

        KNNHeap newHeap​(int k)
        Create an heap for kNN search.
        Parameters:
        k - K value
        Returns:
        New heap of size k.
      • newHeap

        KNNHeap newHeap​(KNNList exist)
        Build a new heap from a given list.
        Parameters:
        exist - Existing result
        Returns:
        New heap
      • getDBIDSerializer

        ByteBufferSerializer<DBID> getDBIDSerializer()
        Get a serializer for DBIDs.
        Returns:
        DBID serializer
      • getTypeRestriction

        java.lang.Class<? extends DBID> getTypeRestriction()
        Get type restriction.
        Returns:
        type restriction for DBIDs
      • compare

        int compare​(DBIDRef a,
                    DBIDRef b)
        Compare two DBIDs, for sorting.
        Parameters:
        a - First
        b - Second
        Returns:
        Comparison result
      • equal

        boolean equal​(DBIDRef a,
                      DBIDRef b)
        Compare two DBIDs, for equality testing.
        Parameters:
        a - First
        b - Second
        Returns:
        Comparison result
      • toString

        java.lang.String toString​(DBIDRef id)
        Print a DBID as string.
        Parameters:
        id - DBID reference
        Returns:
        Formatted ID
      • invalid

        DBIDRef invalid()
        Get the invalid DBID value, usable as "undefined" placeholder.
        Returns:
        Invalid value
      • newDistanceDBIDList

        ModifiableDoubleDBIDList newDistanceDBIDList​(int size)
        Create a modifiable list to store distance-DBID pairs.
        Parameters:
        size - initial size estimate
        Returns:
        New list of given initial size
      • newDistanceDBIDList

        ModifiableDoubleDBIDList newDistanceDBIDList()
        Create a modifiable list to store distance-DBID pairs.
        Returns:
        New list
      • makeUnmodifiable

        StaticDBIDs makeUnmodifiable​(DBIDs existing)
        Make DBIDs immutable.
        Parameters:
        existing - Existing DBIDs
        Returns:
        Immutable version