/* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; import java.util.*; /** * Interfaces and utilities declaring per-element operations used * within parallel methods on aggregates. This class provides type * names for all 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. In keeping with normal Java evaluation rules * that promote, for example short to int, operation * names for these smaller types are absent. * *
Preliminary release note: Some of the declarations in this * class are likely to be moved elsewhere in the JDK libraries * upon actual release, and most likely will not all nested in the * same class. * *
The naming conventions are as follows: *
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 is normally best used via import static.
*/
public class Ops {
private Ops() {} // disable construction
// Thanks to David Biesack for the above html table
// You want to read/edit this with a wide editor panel
public static interface Op { R op(A a);}
public static interface BinaryOp { R op(A a, B b);}
public static interface Predicate { boolean op(A a);}
public static interface BinaryPredicate { boolean op(A a, B b);}
public static interface Procedure { void op(A a);}
public static interface Generator