Interface IIndexTable

    • Method Detail

      • getInputKey

        IInputKey getInputKey()
        Returns:
        the input key indexed by this table
      • enumerateTuples

        default java.lang.Iterable<Tuple> enumerateTuples​(TupleMask seedMask,
                                                          ITuple seed)
        Returns the tuples, optionally seeded with the given tuple.

        Consider using the more idiomatic streamTuples(TupleMask, ITuple) instead.

        Parameters:
        seedMask - a mask that extracts those parameters of the input key (from the entire parameter list) that should be bound to a fixed value; must not be null. Note: any given index must occur at most once in seedMask.
        seed - the tuple of fixed values restricting the row set to be considered, in the same order as given in parameterSeedMask, so that for each considered row tuple, projectedParameterSeed.equals(parameterSeedMask.transform(row)) should hold. Must not be null.
        Returns:
        the tuples in the table for the given key and seed
      • streamTuples

        java.util.stream.Stream<? extends Tuple> streamTuples​(TupleMask seedMask,
                                                              ITuple seed)
        Returns the tuples, optionally seeded with the given tuple.
        Parameters:
        seedMask - a mask that extracts those parameters of the input key (from the entire parameter list) that should be bound to a fixed value; must not be null. Note: any given index must occur at most once in seedMask.
        seed - the tuple of fixed values restricting the row set to be considered, in the same order as given in parameterSeedMask, so that for each considered row tuple, projectedParameterSeed.equals(parameterSeedMask.transform(row)) should hold. Must not be null.
        Returns:
        the tuples in the table for the given key and seed
        Since:
        2.1
      • enumerateValues

        default java.lang.Iterable<? extends java.lang.Object> enumerateValues​(TupleMask seedMask,
                                                                               ITuple seed)
        Simpler form of enumerateTuples(TupleMask, ITuple) in the case where all values of the tuples are bound by the seed except for one.

        Selects the tuples in the table, optionally seeded with the given tuple, and then returns the single value from each tuple which is not bound by the seed mask.

        Consider using the more idiomatic streamValues(TupleMask, ITuple) instead.

        Parameters:
        seedMask - a mask that extracts those parameters of the input key (from the entire parameter list) that should be bound to a fixed value; must not be null. Note: any given index must occur at most once in seedMask, and seedMask must include all parameters in any arbitrary order except one.
        seed - the tuple of fixed values restricting the row set to be considered, in the same order as given in parameterSeedMask, so that for each considered row tuple, projectedParameterSeed.equals(parameterSeedMask.transform(row)) should hold. Must not be null.
        Returns:
        the objects in the table for the given key and seed
      • streamValues

        java.util.stream.Stream<? extends java.lang.Object> streamValues​(TupleMask seedMask,
                                                                         ITuple seed)
        Simpler form of enumerateTuples(TupleMask, ITuple) in the case where all values of the tuples are bound by the seed except for one.

        Selects the tuples in the table, optionally seeded with the given tuple, and then returns the single value from each tuple which is not bound by the seed mask.

        Parameters:
        seedMask - a mask that extracts those parameters of the input key (from the entire parameter list) that should be bound to a fixed value; must not be null. Note: any given index must occur at most once in seedMask, and seedMask must include all parameters in any arbitrary order except one.
        seed - the tuple of fixed values restricting the row set to be considered, in the same order as given in parameterSeedMask, so that for each considered row tuple, projectedParameterSeed.equals(parameterSeedMask.transform(row)) should hold. Must not be null.
        Returns:
        the objects in the table for the given key and seed
        Since:
        2.1
      • containsTuple

        boolean containsTuple​(ITuple seed)
        Simpler form of enumerateTuples(TupleMask, ITuple) in the case where all values of the tuples are bound by the seed.

        Returns whether the given tuple is in the table identified by the input key.

        Parameters:
        seed - a row tuple of fixed values whose presence in the table is queried
        Returns:
        true iff there is a row tuple contained in the table that corresponds to the given seed
      • countTuples

        int countTuples​(TupleMask seedMask,
                        ITuple seed)
        Returns the number of tuples, optionally seeded with the given tuple.

        Selects the tuples in the table, optionally seeded with the given tuple, and then returns their number.

        Parameters:
        seedMask - a mask that extracts those parameters of the input key (from the entire parameter list) that should be bound to a fixed value; must not be null. Note: any given index must occur at most once in seedMask.
        seed - the tuple of fixed values restricting the row set to be considered, in the same order as given in parameterSeedMask, so that for each considered row tuple, projectedParameterSeed.equals(parameterSeedMask.transform(row)) should hold. Must not be null.
        Returns:
        the number of tuples in the table for the given key and seed
      • estimateProjectionSize

        java.util.Optional<java.lang.Long> estimateProjectionSize​(TupleMask groupMask,
                                                                  Accuracy requiredAccuracy)
        Gives an estimate of the number of different groups the tuples of the table are projected into by the given mask (e.g. for an identity mask, this means the full relation size). The estimate must meet the required accuracy.

        Derived tables may return Optional.empty() if it would be costly to provide an answer up to the required precision. Direct storage tables are expected to always be able to give an exact count.

        PRE: TupleMask.isNonrepeating() must hold for the group mask.

        Since:
        2.1
      • addUpdateListener

        void addUpdateListener​(Tuple seed,
                               IQueryRuntimeContextListener listener)
        Subscribes for updates in the table, optionally seeded with the given tuple.

        This should be called after initializing a result cache by an enumeration method.

        Parameters:
        seed - can be null or a tuple with matching arity; if non-null, notifications will delivered only about those updates of the table that match the seed at positions where the seed is non-null.
        listener - will be notified of future changes
        Since:
        2.1