DPJRuntime
Class DPJPartitionBoolean<region R>

java.lang.Object
  extended by DPJRuntime.DPJPartitionBoolean<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 DPJPartitionBoolean<region R>
extends java.lang.Object

The DPJPartition class, specialized to boolean.

The DPJPartitionBoolean class represents an array of DPJArrayBoolean objects that partition another DPJArrayBoolean (called the root array). Each DPJArrayBoolean in the partition is a contiguous subsection of the root array, and all are mutually disjoint. The DPJArrayBooleans 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
DPJPartitionBoolean(DPJArrayBoolean<R> A, int idx)
          Partitions an array A into two segments at index idx.
DPJPartitionBoolean(DPJArrayBoolean<R> A, int[]<RI> idxs)
          Partitions an array A into idxs.length+1 segments using the indices in idxs as the split points.
DPJPartitionBoolean(DPJArrayBoolean<R> A, int idx, boolean exclude)
          Partitions an array A into two segments at idx, optionally excluding the element at idx.
 
Method Summary
 DPJArrayBoolean<this : [idx] : *> get(int idx)
          Returns segment idx of the partition.
static
<region R> DPJPartitionBoolean<R>
stridedPartition(DPJArrayBoolean<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

DPJPartitionBoolean

public DPJPartitionBoolean(DPJArrayBoolean<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

DPJPartitionBoolean

public DPJPartitionBoolean(DPJArrayBoolean<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

DPJPartitionBoolean

public <region RI> DPJPartitionBoolean(DPJArrayBoolean<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> DPJPartitionBoolean<R> stridedPartition(DPJArrayBoolean<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 DPJArrayBoolean<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