@Override
        public List<? extends Device> chooseDevices(List<? extends Platform> platforms) {
            availablePlatforms = platforms;
            
            Platform platform = null;
            for (Platform p : platforms) {
                if (p.getName().equals(selectedPlatform)) {
                    platform = p;
                    break;
                }
            }
            if (platform == null) {
                platform = platforms.get(0);
            }
            selectedPlatform = platform.getName();
            
            Device device = null;
            for (Device d : platform.getDevices()) {
                if (d.getName().equals(selectedDevice)) {
                    device = d;
                    break;
                }
            }
            if (device == null) {
                for (Device d : platform.getDevices()) {
                    if (d.getDeviceType() == Device.DeviceType.GPU) {
                        device = d;
                        break;
                    }
                }
            }
            if (device == null) {
                device = platform.getDevices().get(0);
            }
            selectedDevice = device.getName();
            
            return Collections.singletonList(device);
        }
@param args the command line arguments
jme3-examples/src/main/java/jme3test/opencl/TestContextSwitching.java