Interface CollectionFactory

  • All Superinterfaces:
    java.lang.AutoCloseable
    All Known Implementing Classes:
    DefaultCollectionFactory

    @InternalUseOnly
    public interface CollectionFactory
    extends java.lang.AutoCloseable
    A Factory that may generate optimised and/or disk based collections Factories like this should not be cached but created a new everytime as the closing is important if they are disk based.
    • Method Detail

      • createList

        <T> java.util.List<T> createList()
        Type Parameters:
        T - of the list
        Returns:
        a list that may be optimised and/or disk based
      • createValueList

        java.util.List<Value> createValueList()
        Returns:
        a list that may be optimised and/or disk based for Values only
      • createSet

        <T> java.util.Set<T> createSet()
        Type Parameters:
        T - of the set
        Returns:
        a set that may be optimised and/or disk based
      • createSetOfBindingSets

        java.util.Set<BindingSet> createSetOfBindingSets()
        Returns:
        a set that may be optimised and/or disk based
      • createValueSet

        java.util.Set<Value> createValueSet()
        Returns:
        a set that may be optimised and/or disk based for Values
      • createMap

        <K,​V> java.util.Map<K,​V> createMap()
        Type Parameters:
        K - key type
        V - value type
        Returns:
        a map
      • createValueKeyedMap

        <V> java.util.Map<Value,​V> createValueKeyedMap()
        Type Parameters:
        V - value type
        Returns:
        a map
      • createQueue

        <T> java.util.Queue<T> createQueue()
        Type Parameters:
        T - of the contents of the queue
        Returns:
        a new queue
      • createValueQueue

        java.util.Queue<Value> createValueQueue()
        Returns:
        a new queue
      • valueIntoObjectOutputStream

        @InternalUseOnly
        @Experimental
        private void valueIntoObjectOutputStream​(Value value,
                                                 java.io.ObjectOutputStream oos)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • valueFromObjectInputStream

        @InternalUseOnly
        @Experimental
        private Value valueFromObjectInputStream​(java.io.ObjectInputStream ois)
                                          throws java.lang.ClassNotFoundException,
                                                 java.io.IOException
        Throws:
        java.lang.ClassNotFoundException
        java.io.IOException
      • hashAValue

        @InternalUseOnly
        default int hashAValue​(java.util.function.Function<BindingSet,​Value> getValue,
                               int nextHash,
                               BindingSet bs)
        Hashes a value that complies with the hashCode/equals conception but only in context of this collection/factory storage layer. Potentially also only valid during a single transaction scope.
        Parameters:
        getValue - the function to extract the value to hash
        nextHash - any previously calculated hash value for earlier values in the BindingSet
        bs - the bindingset to take the value from
        Returns:
        a hash function
      • hashOfBindingSetFuntion

        @InternalUseOnly
        default java.util.function.ToIntFunction<BindingSet> hashOfBindingSetFuntion​(java.util.List<java.util.function.Function<BindingSet,​Value>> getValues)
        Generate a method that calculates a hash code that is valid in context of a single store implementation and QueryExecutionContext.
        Parameters:
        getValues - that should be considered in the hash
        Returns:
        a hash function