DPJRuntime
Class DPJPartitionByte<region R>

java.lang.Object
  extended by DPJRuntime.DPJPartitionByte<region R>
Type Parameters:
T - The type of an element of an array in the partition
R - The region of a cell of an array in the partition

public class DPJPartitionByte<region R>
extends java.lang.Object

The DPJPartition class, specialized to byte.

The DPJPartitionByte class represents an array of DPJArrayByte objects that partition another DPJArrayByte (called the root array). Each DPJArrayByte in the partition is a contiguous subsection of the root array, and all are mutually disjoint. The DPJArrayBytes in the partition are called segments of the root array.

For example, if the root array has index space [0,10], then a partition might have segments with index spaces [0,5] and [6,10].


Field Summary
 int length
          Number of segments in the partition
 
Constructor Summary
DPJPartitionByte(DPJArrayByte<R> A, int idx)
          Partitions an array A into two segments at index idx.
DPJPartitionByte(DPJArrayByte<R> A, int[]<RI> idxs)
          Partitions an array A into idxs.length+1 segments using the indices in idxs as the split points.
DPJPartitionByte(DPJArrayByte<R> A, int idx, boolean exclude)
          Partitions an array A into two segments at idx, optionally excluding the element at idx.
 
Method Summary
 DPJArrayByte<this : [idx] : *> get(int idx)
          Returns segment idx of the partition.
static
<region R> DPJPartitionByte<R>
stridedPartition(DPJArrayByte<R> A, int stride)
          Creates a partition using stride stride.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

length

public final int length
Number of segments in the partition

Constructor Detail

DPJPartitionByte

public DPJPartitionByte(DPJArrayByte<R> A,
                        int idx)
                 writes this : [?]
Partitions an array A into two segments at index idx. If A has n elements, then the first segment consists of elements 0 through idx-1, and the second segment consists of elements idx through n-1.

Throws ArrayIndexOutOfBoundsException if idx is not in [0,n-1].

Parameters:
A - The array to partition
idx - The partition index

DPJPartitionByte

public DPJPartitionByte(DPJArrayByte<R> A,
                        int idx,
                        boolean exclude)
                 writes this : [?]
Partitions an array A into two segments at idx, optionally excluding the element at idx. If A has n elements, then the first segment is always [0,idx-1]. The second segment is either [idx,n-1] (if exclude is false) or [idx+1,n-1] (if exclude is true).

Throws ArrayIndexOutOfBoundsException if idx is not in [0,n-1].

Parameters:
A - The array to partition
idx - The partition index
exclude - Whether to exclude the element at idx from the segments

DPJPartitionByte

public <region RI> DPJPartitionByte(DPJArrayByte<R> A,
                                    int[]<RI> idxs)
                 reads  RI
                 writes this : [?]
Partitions an array A into idxs.length+1 segments using the indices in idxs as the split points. If A has index space [0,n-1], then the segments are [0,idxs[0]-1], [idxs[0],idxs[1]-1], ..., [idxs[idxs.length-1]-1,n-1]. Throws ArrayOutOfBoundsException if the indices are not monotonically increasing, or if any index is out of bounds for A.

Type Parameters:
RI - The region of array idxs
Parameters:
A - The array to partition
idxs - The split points
Method Detail

stridedPartition

public static <region R> DPJPartitionByte<R> stridedPartition(DPJArrayByte<R> A,
                                                              int stride)
                                            pure
Creates a partition using stride stride. For example, partitioning a 10-element array with stride 2 creates a partition with 5 segments, each of length 2.

Type Parameters:
T - The type of the array to partition
R - The region of the array to partition
Parameters:
A - The array to partition
stride - The stride at which to partition
Returns:
A partition of A with stride stride

get

public DPJArrayByte<this : [idx] : *> get(int idx)
                                   reads  this : [idx]
Returns segment idx of the partition.

Throws ArrayIndexOutOfBoundsException if idx is not a valid segment index.

Parameters:
idx - Index of the segment to get
Returns:
Segment idx of the partition