Simplify casting expression

This commit is contained in:
Laurent Clouet
2015-03-31 22:04:09 +01:00
parent 12e1a11065
commit ad6547d3d9

View File

@@ -186,16 +186,10 @@ public class Worker {
} }
if (method != null) { if (method != null) {
if (method.equalsIgnoreCase("cpu")) { try {
compute_method = ComputeType.CPU_ONLY; compute_method = ComputeType.valueOf(method);
} }
else if (method.equalsIgnoreCase("gpu")) { catch (IllegalArgumentException e) {
compute_method = ComputeType.GPU_ONLY;
}
else if (method.equalsIgnoreCase("cpu_gpu") || method.equalsIgnoreCase("gpu_cpu")) {
compute_method = ComputeType.CPU_GPU;
}
else {
System.err.println("Error: compute-method unknown"); System.err.println("Error: compute-method unknown");
System.exit(2); System.exit(2);
} }