Class MapPartitionsPLL<U,​T>

  • Type Parameters:
    U -
    T -

    public class MapPartitionsPLL<U,​T>
    extends PLL<T>
    A PLL obtained by transforming each partition independently. The supplied function takes two arguments: the first is the index of the partition to map, the second is a stream of its contents.
    Author:
    Antonin Delpeuch
    • Constructor Detail

      • MapPartitionsPLL

        public MapPartitionsPLL​(PLL<U> parent,
                                BiFunction<Integer,​CloseableIterator<U>,​CloseableIterator<T>> mapFunction,
                                String mapFunctionDescription)
        Constructs a PLL with partitions derived one-to-one from the parent.
        Parameters:
        parent - the source list
        mapFunction - the function to apply to each partition
        mapFunctionDescription - a short description of the map function for debugging purposes
      • MapPartitionsPLL

        protected MapPartitionsPLL​(PLL<U> parent,
                                   BiFunction<Integer,​CloseableIterator<U>,​CloseableIterator<T>> mapFunction,
                                   String mapFunctionDescription,
                                   boolean preservesSizes)
        Constructs a PLL with partitions derived one-to-one from the parent.
        Parameters:
        parent - the source list
        mapFunction - the function to apply to each partition
        mapFunctionDescription - a short description of the map function for debugging purposes
        preservesSizes - whether partition sizes are know to be the same as the parent's
    • Method Detail

      • hasCachedPartitionSizes

        public boolean hasCachedPartitionSizes()
        Description copied from class: PLL
        Is this PLL aware of the size of its partitions?
        Overrides:
        hasCachedPartitionSizes in class PLL<T>
      • compute

        public CloseableIterator<T> compute​(Partition partition)
        Description copied from class: PLL
        Iterate over the elements of the given partition. This is the method that should be implemented by subclasses. As this method forces computation, ignoring any caching, consumers should not call it directly but rather use PLL.iterate(Partition). Once the iterator is not needed anymore, it should be closed. This makes it possible to release the underlying resources supporting it, such as open files or sockets.
        Specified by:
        compute in class PLL<T>
        Parameters:
        partition - the partition to iterate over
        Returns:
      • getPartitions

        public io.vavr.collection.Array<? extends Partition> getPartitions()
        Specified by:
        getPartitions in class PLL<T>
        Returns:
        the partitions in this list
      • getParents

        public List<PLL<?>> getParents()
        Description copied from class: PLL
        Returns the PLLs that this PLL depends on, to compute its contents. This is used for debugging purposes, to display the tree of dependencies of a given PLL.
        Specified by:
        getParents in class PLL<T>
        See Also:
        PLL.getQueryTree()