simplify switch case flow for DownloadMission

This commit is contained in:
Alex 2024-04-27 17:03:24 +07:00
parent 8e3449180f
commit c57f14bca5
No known key found for this signature in database
GPG Key ID: C9ABDE12115262C4
1 changed files with 9 additions and 17 deletions

View File

@ -396,17 +396,11 @@ public class DownloadMission extends Mission {
} }
private void notifyPostProcessing(int state) { private void notifyPostProcessing(int state) {
String action; String action = switch (state) {
switch (state) { case 1 -> "Running";
case 1: case 2 -> "Completed";
action = "Running"; default -> "Failed";
break; };
case 2:
action = "Completed";
break;
default:
action = "Failed";
}
Log.d(TAG, action + " postprocessing on " + storage.getName()); Log.d(TAG, action + " postprocessing on " + storage.getName());
@ -590,13 +584,11 @@ public class DownloadMission extends Mission {
* @return {@code true} if this mission is unrecoverable * @return {@code true} if this mission is unrecoverable
*/ */
public boolean isPsFailed() { public boolean isPsFailed() {
switch (errCode) { return switch (errCode) {
case ERROR_POSTPROCESSING: case ERROR_POSTPROCESSING, ERROR_POSTPROCESSING_STOPPED -> psAlgorithm.worksOnSameFile;
case ERROR_POSTPROCESSING_STOPPED: default -> false;
return psAlgorithm.worksOnSameFile; };
}
return false;
} }
/** /**