aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/util/CLUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/jogamp/opencl/util/CLUtil.java')
-rw-r--r--src/com/jogamp/opencl/util/CLUtil.java68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/com/jogamp/opencl/util/CLUtil.java b/src/com/jogamp/opencl/util/CLUtil.java
index 98a6cd7e..bcab6767 100644
--- a/src/com/jogamp/opencl/util/CLUtil.java
+++ b/src/com/jogamp/opencl/util/CLUtil.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -48,7 +48,7 @@ import java.util.Map;
*/
public class CLUtil {
- public static String clString2JavaString(byte[] chars, int clLength) {
+ public static String clString2JavaString(final byte[] chars, int clLength) {
// certain char queries on windows always claim to have a fixed length
// e.g. (clDeviceInfo(CL_DEVICE_NAME) is always 64.. but luckily they are 0 terminated)
@@ -57,11 +57,11 @@ public class CLUtil {
return clLength==0 ? "" : new String(chars, 0, clLength+1);
}
- public static String clString2JavaString(ByteBuffer chars, int clLength) {
+ public static String clString2JavaString(final ByteBuffer chars, final int clLength) {
if (clLength==0) {
return "";
}else{
- byte[] array = new byte[clLength];
+ final byte[] array = new byte[clLength];
chars.get(array).rewind();
return clString2JavaString(array, clLength);
}
@@ -70,48 +70,48 @@ public class CLUtil {
/**
* Returns true if clBoolean == CL.CL_TRUE.
*/
- public static boolean clBoolean(int clBoolean) {
+ public static boolean clBoolean(final int clBoolean) {
return clBoolean == CL.CL_TRUE;
}
/**
* Returns b ? CL.CL_TRUE : CL.CL_FALSE
*/
- public static int clBoolean(boolean b) {
+ public static int clBoolean(final boolean b) {
return b ? CL.CL_TRUE : CL.CL_FALSE;
}
/**
* Reads all platform properties and returns them as key-value map.
*/
- public static Map<String, String> obtainPlatformProperties(CLPlatform platform) {
+ public static Map<String, String> obtainPlatformProperties(final CLPlatform platform) {
return readCLProperties(platform);
}
/**
* Reads all device properties and returns them as key-value map.
*/
- public static Map<String, String> obtainDeviceProperties(CLDevice dev) {
+ public static Map<String, String> obtainDeviceProperties(final CLDevice dev) {
return readCLProperties(dev);
}
- private static Map<String, String> readCLProperties(Object obj) {
+ private static Map<String, String> readCLProperties(final Object obj) {
try {
return invoke(listMethods(obj.getClass()), obj);
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
throw new JogampRuntimeException(ex);
- } catch (IllegalAccessException ex) {
+ } catch (final IllegalAccessException ex) {
throw new JogampRuntimeException(ex);
}
}
- static Map<String, String> invoke(List<Method> methods, Object obj) throws IllegalArgumentException, IllegalAccessException {
- Map<String, String> map = new LinkedHashMap<String, String>();
- for (Method method : methods) {
+ static Map<String, String> invoke(final List<Method> methods, final Object obj) throws IllegalArgumentException, IllegalAccessException {
+ final Map<String, String> map = new LinkedHashMap<String, String>();
+ for (final Method method : methods) {
Object info = null;
try {
info = method.invoke(obj);
- } catch (InvocationTargetException ex) {
+ } catch (final InvocationTargetException ex) {
info = ex.getTargetException();
}
@@ -119,17 +119,17 @@ public class CLUtil {
info = asList(info);
}
- String value = method.getAnnotation(CLProperty.class).value();
+ final String value = method.getAnnotation(CLProperty.class).value();
map.put(value, info.toString());
}
return map;
}
- static List<Method> listMethods(Class<?> clazz) throws SecurityException {
- List<Method> list = new ArrayList<Method>();
- for (Method method : clazz.getDeclaredMethods()) {
- Annotation[] annotations = method.getDeclaredAnnotations();
- for (Annotation annotation : annotations) {
+ static List<Method> listMethods(final Class<?> clazz) throws SecurityException {
+ final List<Method> list = new ArrayList<Method>();
+ for (final Method method : clazz.getDeclaredMethods()) {
+ final Annotation[] annotations = method.getDeclaredAnnotations();
+ for (final Annotation annotation : annotations) {
if (annotation instanceof CLProperty) {
list.add(method);
}
@@ -138,26 +138,26 @@ public class CLUtil {
return list;
}
- private static List<Number> asList(Object info) {
- List<Number> list = new ArrayList<Number>();
+ private static List<Number> asList(final Object info) {
+ final List<Number> list = new ArrayList<Number>();
if(info instanceof int[]) {
- int[] array = (int[]) info;
- for (int i : array) {
+ final int[] array = (int[]) info;
+ for (final int i : array) {
list.add(i);
}
}else if(info instanceof long[]) {
- long[] array = (long[]) info;
- for (long i : array) {
+ final long[] array = (long[]) info;
+ for (final long i : array) {
list.add(i);
}
}else if(info instanceof float[]) {
- float[] array = (float[]) info;
- for (float i : array) {
+ final float[] array = (float[]) info;
+ for (final float i : array) {
list.add(i);
}
}else if(info instanceof double[]) {
- double[] array = (double[]) info;
- for (double i : array) {
+ final double[] array = (double[]) info;
+ for (final double i : array) {
list.add(i);
}
}