Examples of IntFunction


Examples of cern.colt.function.IntFunction

/**
* Constructs a function that returns <tt>a & b</tt>.
* <tt>a</tt> is a variable, <tt>b</tt> is fixed.
*/
public static IntFunction and(final int b) {
  return new IntFunction() {
    public final int apply(int a) { return a & b; }
  };
}
View Full Code Here

Examples of cern.colt.function.IntFunction

/**
* Constructs a function that returns <tt>(from<=a && a<=to) ? 1 : 0</tt>.
* <tt>a</tt> is a variable, <tt>from</tt> and <tt>to</tt> are fixed.
*/
public static IntFunction between(final int from, final int to) {
  return new IntFunction() {
    public final int apply(int a) { return (from<=a && a<=to) ? 1 : 0; }
  };
}
View Full Code Here

Examples of cern.colt.function.IntFunction

*
* @param function a binary function taking operands in the form <tt>function.apply(c,var)</tt>.
* @return the unary function <tt>function(c,var)</tt>.
*/
public static IntFunction bindArg1(final IntIntFunction function, final int c) {
  return new IntFunction() {
    public final int apply(int var) { return function.apply(c,var); }
  };
}
View Full Code Here

Examples of cern.colt.function.IntFunction

*
* @param function a binary function taking operands in the form <tt>function.apply(var,c)</tt>.
* @return the unary function <tt>function(var,c)</tt>.
*/
public static IntFunction bindArg2(final IntIntFunction function, final int c) {
  return new IntFunction() {
    public final int apply(int var) { return function.apply(var,c); }
  };
}
View Full Code Here

Examples of cern.colt.function.IntFunction

* @param g a unary function.
* @param h a unary function.
* @return the unary function <tt>g( h(a) )</tt>.
*/
public static IntFunction chain(final IntFunction g, final IntFunction h) {
  return new IntFunction() {
    public final int apply(int a) { return g.apply(h.apply(a)); }
  };
}
View Full Code Here

Examples of cern.colt.function.IntFunction

/**
* Constructs a function that returns <tt>a < b ? -1 : a > b ? 1 : 0</tt>.
* <tt>a</tt> is a variable, <tt>b</tt> is fixed.
*/
public static IntFunction compare(final int b) {
  return new IntFunction() {
    public final int apply(int a) { return a < b ? -1 : a > b ? 1 : 0; }
  };
}
View Full Code Here

Examples of cern.colt.function.IntFunction

}
/**
* Constructs a function that returns the constant <tt>c</tt>.
*/
public static IntFunction constant(final int c) {
  return new IntFunction() {
    public final int apply(int a) { return c; }
  };
}
View Full Code Here

Examples of cern.colt.function.IntFunction

/**
* Constructs a function that returns <tt>a / b</tt>.
* <tt>a</tt> is a variable, <tt>b</tt> is fixed.
*/
public static IntFunction div(final int b) {
  return new IntFunction() {
    public final int apply(int a) { return a / b; }
  };
}
View Full Code Here

Examples of cern.colt.function.IntFunction

/**
* Constructs a function that returns <tt>a == b ? 1 : 0</tt>.
* <tt>a</tt> is a variable, <tt>b</tt> is fixed.
*/
public static IntFunction equals(final int b) {
  return new IntFunction() {
    public final int apply(int a) { return a == b ? 1 : 0; }
  };
}
View Full Code Here

Examples of cern.colt.function.IntFunction

/**
* Constructs a function that returns <tt>Math.max(a,b)</tt>.
* <tt>a</tt> is a variable, <tt>b</tt> is fixed.
*/
public static IntFunction max(final int b) {
  return new IntFunction() {
    public final int apply(int a) { return (a >= b) ? a : b; }
  };
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.