com.nativelibs4java.opencl.util.Fun2 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javacl Show documentation
Show all versions of javacl Show documentation
JavaCL is an Object-Oriented API that makes the C OpenCL API available to Java in a very natural way.
It hides away the complexity of cross-platform C bindings, has a clean OO design (with generics, Java enums, NIO buffers, fully typed exceptions...), provides high-level features (OpenGL-interop, array reductions) and comes with samples and demos.
For more info, please visit http://code.google.com/p/nativelibs4java/wiki/OpenCL.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.nativelibs4java.opencl.util;
public enum Fun2 {
min,
max,
atan2,
dist,
modulo("%"),
rshift(">>"),
lshift("<<"),
xor("^"),
bitOr("|"),
bitAnd("&"),
add("+"),
substract("-"),
multiply("*"),
divide("/");
String infixOp;
Fun2() {}
Fun2(String infixOp) {
this.infixOp = infixOp;
}
void expr(String a, String b, StringBuilder out) {
if (infixOp == null)
out.append(name()).append('(').append(a).append(", ").append(b).append(")");
else
out.append(a).append(' ').append(infixOp).append(' ').append(b);
}
}