Class CroppedPartitioner<T>

  • Type Parameters:
    T -
    All Implemented Interfaces:
    Partitioner<T>

    public class CroppedPartitioner<T>
    extends Object
    implements Partitioner<T>
    A partitionner for a PLL which was amputed from some partitions.
    Author:
    Antonin Delpeuch
    • Constructor Detail

      • CroppedPartitioner

        protected CroppedPartitioner​(Partitioner<T> parent,
                                     int partitionsToDrop,
                                     boolean atEnd)
        Constructs the partitioner based on the partitioner for the uncropped PLL.
        Parameters:
        parent - the partitioner for the original PLL
        partitionsToDrop - the number of partitions which were dropped from that PLL
        atEnd - true if the partitions were dropped at the end, false if at the beginning
        See Also:
        which attempts to preserve the partioner type
    • Method Detail

      • getPartition

        public int getPartition​(T key)
        Description copied from interface: Partitioner
        Retrieves the partition id given a key.
        Specified by:
        getPartition in interface Partitioner<T>
        Returns:
      • numPartitions

        public int numPartitions()
        Description copied from interface: Partitioner
        Returns the number of partitions assumed by this partitioner.
        Specified by:
        numPartitions in interface Partitioner<T>
      • crop

        public static <T> Partitioner<T> crop​(Partitioner<T> partitioner,
                                              int partitionsToDrop,
                                              boolean atEnd)
        Constructs the partitioner based on the partitioner for the uncropped PLL.
        Parameters:
        partitioner - the partitioner for the original PLL
        partitionsToDrop - the number of partitions which were dropped from that PLL
        atEnd - true if the partitions were dropped at the end, false if at the beginning