diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:35:47 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:35:47 +0200 |
commit | a90ee128ce0550cd05f969d0283312c2f42b8254 (patch) | |
tree | dade644101970d8f69ea3845db310499f2b66a76 /src/com/jogamp/opencl/util/CLMultiContext.java | |
parent | a0e0c8a39d0ef41ff6b64d9b40d058f21b786e81 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/com/jogamp/opencl/util/CLMultiContext.java')
-rw-r--r-- | src/com/jogamp/opencl/util/CLMultiContext.java | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/com/jogamp/opencl/util/CLMultiContext.java b/src/com/jogamp/opencl/util/CLMultiContext.java index c5bed86b..c5624bb4 100644 --- a/src/com/jogamp/opencl/util/CLMultiContext.java +++ b/src/com/jogamp/opencl/util/CLMultiContext.java @@ -34,7 +34,7 @@ public class CLMultiContext implements CLResource { /** * Creates a multi context with all devices of the specified platforms. */ - public static CLMultiContext create(CLPlatform... platforms) { + public static CLMultiContext create(final CLPlatform... platforms) { return create(platforms, ALL); } @@ -42,7 +42,7 @@ public class CLMultiContext implements CLResource { * Creates a multi context with all devices of the specified platforms and types. */ @SuppressWarnings("unchecked") - public static CLMultiContext create(CLPlatform[] platforms, CLDevice.Type... types) { + public static CLMultiContext create(final CLPlatform[] platforms, final CLDevice.Type... types) { return create(platforms, CLDeviceFilters.type(types)); } @@ -50,7 +50,7 @@ public class CLMultiContext implements CLResource { * Creates a multi context with all matching devices of the specified platforms. */ @SuppressWarnings("unchecked") - public static CLMultiContext create(CLPlatform[] platforms, Filter<CLDevice>... filters) { + public static CLMultiContext create(final CLPlatform[] platforms, final Filter<CLDevice>... filters) { if(platforms == null) { throw new NullPointerException("platform list was null"); @@ -58,8 +58,8 @@ public class CLMultiContext implements CLResource { throw new IllegalArgumentException("platform list was empty"); } - List<CLDevice> devices = new ArrayList<CLDevice>(); - for (CLPlatform platform : platforms) { + final List<CLDevice> devices = new ArrayList<CLDevice>(); + for (final CLPlatform platform : platforms) { devices.addAll(asList(platform.listCLDevices(filters))); } return create(devices); @@ -69,21 +69,21 @@ public class CLMultiContext implements CLResource { * Creates a multi context with the specified devices. * The devices don't have to be from the same platform. */ - public static CLMultiContext create(Collection<CLDevice> devices) { + public static CLMultiContext create(final Collection<CLDevice> devices) { if(devices.isEmpty()) { throw new IllegalArgumentException("device list was empty"); } - Map<CLPlatform, List<CLDevice>> platformDevicesMap = filterPlatformConflicts(devices); + final Map<CLPlatform, List<CLDevice>> platformDevicesMap = filterPlatformConflicts(devices); // create contexts - CLMultiContext mc = new CLMultiContext(); - for (Map.Entry<CLPlatform, List<CLDevice>> entry : platformDevicesMap.entrySet()) { - List<CLDevice> list = entry.getValue(); + final CLMultiContext mc = new CLMultiContext(); + for (final Map.Entry<CLPlatform, List<CLDevice>> entry : platformDevicesMap.entrySet()) { + final List<CLDevice> list = entry.getValue(); // one context per device to workaround driver bugs - for (CLDevice device : list) { - CLContext context = CLContext.create(device); + for (final CLDevice device : list) { + final CLContext context = CLContext.create(device); mc.contexts.add(context); } } @@ -94,8 +94,8 @@ public class CLMultiContext implements CLResource { /** * Creates a multi context with specified contexts. */ - public static CLMultiContext wrap(CLContext... contexts) { - CLMultiContext mc = new CLMultiContext(); + public static CLMultiContext wrap(final CLContext... contexts) { + final CLMultiContext mc = new CLMultiContext(); mc.contexts.addAll(asList(contexts)); return mc; } @@ -104,19 +104,19 @@ public class CLMultiContext implements CLResource { * filter devices; don't allow the same device to be used in more than one platform. * example: a CPU available via the AMD and Intel SDKs shouldn't end up in two contexts */ - private static Map<CLPlatform, List<CLDevice>> filterPlatformConflicts(Collection<CLDevice> devices) { + private static Map<CLPlatform, List<CLDevice>> filterPlatformConflicts(final Collection<CLDevice> devices) { // FIXME: devicename-platform is used as unique device identifier - replace if we have something better - - Map<CLPlatform, List<CLDevice>> filtered = new HashMap<CLPlatform, List<CLDevice>>(); - Map<String, CLPlatform> used = new HashMap<String, CLPlatform>(); - for (CLDevice device : devices) { + final Map<CLPlatform, List<CLDevice>> filtered = new HashMap<CLPlatform, List<CLDevice>>(); + final Map<String, CLPlatform> used = new HashMap<String, CLPlatform>(); - String name = device.getName(); + for (final CLDevice device : devices) { - CLPlatform platform = device.getPlatform(); - CLPlatform usedPlatform = used.get(name); + final String name = device.getName(); + + final CLPlatform platform = device.getPlatform(); + final CLPlatform usedPlatform = used.get(name); if(usedPlatform == null || platform.equals(usedPlatform)) { if(!filtered.containsKey(platform)) { @@ -125,7 +125,7 @@ public class CLMultiContext implements CLResource { filtered.get(platform).add(device); used.put(name, platform); } - + } return filtered; } @@ -141,7 +141,7 @@ public class CLMultiContext implements CLResource { throw new RuntimeException(getClass().getSimpleName()+" already released"); } released = true; - for (CLContext context : contexts) { + for (final CLContext context : contexts) { context.release(); } contexts.clear(); @@ -155,8 +155,8 @@ public class CLMultiContext implements CLResource { * Returns a list containing all devices used in this multi context. */ public List<CLDevice> getDevices() { - List<CLDevice> devices = new ArrayList<CLDevice>(); - for (CLContext context : contexts) { + final List<CLDevice> devices = new ArrayList<CLDevice>(); + for (final CLContext context : contexts) { devices.addAll(asList(context.getDevices())); } return devices; |