jsr166z.forkjoin
Class Ops

java.lang.Object
  extended by jsr166z.forkjoin.Ops

public class Ops
extends java.lang.Object

Interfaces and utilities describing per-element operations used within parallel methods on aggregates. This class provides type names for common operation signatures accepting zero, one or two arguments, and returning zero or one results, for parameterized types, as well as specializations to int, long, and double. (Lesser used types like short are absent.)

In addition to stated signatures, implementations of these interfaces must work safely in parallel. In general, this means methods should operate only on their arguments, and should not rely on ThreadLocals, unsafely published globals, or other unsafe constructions. Additionally, they should not block waiting for synchronization.

This class also contains a few commonly used implementations of some of these interfaces

This class is normally best used via import static.


Nested Class Summary
static class Ops.CompoundMapper<T,U,V>
          A composite mapper that applies a second mapper to the results of applying the first one
static class Ops.DoubleMaxReducer
          A reducer returning the maximum of two double elements, using the given comparator
static class Ops.DoubleMinReducer
          A reducer returning the minimum of two double elements, using the given comparator
static class Ops.IntMaxReducer
          A reducer returning the maximum of two int elements, using the given comparator
static class Ops.IntMinReducer
          A reducer returning the minimum of two int elements, using the given comparator
static class Ops.LongMaxReducer
          A reducer returning the maximum of two long elements, using the given comparator
static class Ops.LongMinReducer
          A reducer returning the minimum of two long elements, using the given comparator
static class Ops.MaxReducer<T>
          A reducer returning the maximum of two elements, using the given comparator, and treating null as less than any non-null element.
static class Ops.MinReducer<T>
          A reducer returning the minimum of two elements, using the given comparator, and treating null as greater than any non-null element.
static class Ops.NaturalMaxReducer<T extends java.lang.Comparable<? super T>>
          A reducer returning the maximum of two Comparable elements, treating null as less than any non-null element.
static class Ops.NaturalMinReducer<T extends java.lang.Comparable<? super T>>
          A reducer returning the minimum of two Comparable elements, treating null as less than any non-null element.
 
Field Summary
static {double,double=>double} doubleAdder
          A reducer that adds two double elements
static {int,int=>int} intAdder
          A reducer that adds two int elements
static {long,long=>long} longAdder
          A reducer that adds two double elements
static {double,double=>int} naturalDoubleComparator
          A comparator for doubles relying on natural ordering
static {double,double=>double} naturalDoubleMaxReducer
          A reducer returning the maximum of two double elements, using natural comparator
static {double,double=>double} naturalDoubleMinReducer
          A reducer returning the minimum of two double elements, using natural comparator
static {int,int=>int} naturalIntComparator
          A comparator for ints relying on natural ordering
static {int,int=>int} naturalIntMaxReducer
          A reducer returning the maximum of two int elements, using natural comparator
static {int,int=>int} naturalIntMinReducer
          A reducer returning the minimum of two int elements, using natural comparator
static {long,long=>int} naturalLongComparator
          A comparator for longs relying on natural ordering
static {long,long=>long} naturalLongMaxReducer
          A reducer returning the maximum of two long elements, using natural comparator
static {long,long=>long} naturalLongMinReducer
          A reducer returning the minimum of two long elements, using natural comparator
 
Constructor Summary
Ops()
           
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doubleAdder

public static final {double,double=>double} doubleAdder
A reducer that adds two double elements


longAdder

public static final {long,long=>long} longAdder
A reducer that adds two double elements


intAdder

public static final {int,int=>int} intAdder
A reducer that adds two int elements


naturalDoubleComparator

public static final {double,double=>int} naturalDoubleComparator
A comparator for doubles relying on natural ordering


naturalDoubleMaxReducer

public static final {double,double=>double} naturalDoubleMaxReducer
A reducer returning the maximum of two double elements, using natural comparator


naturalDoubleMinReducer

public static final {double,double=>double} naturalDoubleMinReducer
A reducer returning the minimum of two double elements, using natural comparator


naturalLongComparator

public static final {long,long=>int} naturalLongComparator
A comparator for longs relying on natural ordering


naturalLongMaxReducer

public static final {long,long=>long} naturalLongMaxReducer
A reducer returning the maximum of two long elements, using natural comparator


naturalLongMinReducer

public static final {long,long=>long} naturalLongMinReducer
A reducer returning the minimum of two long elements, using natural comparator


naturalIntComparator

public static final {int,int=>int} naturalIntComparator
A comparator for ints relying on natural ordering


naturalIntMaxReducer

public static final {int,int=>int} naturalIntMaxReducer
A reducer returning the maximum of two int elements, using natural comparator


naturalIntMinReducer

public static final {int,int=>int} naturalIntMinReducer
A reducer returning the minimum of two int elements, using natural comparator

Constructor Detail

Ops

public Ops()