Pavlin Radoslavov

Replaced another instance of deep nested "if..else" statement with

"switch..case".
No functional changes.
...@@ -82,12 +82,28 @@ public class SimpleIntentStore ...@@ -82,12 +82,28 @@ public class SimpleIntentStore
82 public IntentEvent setState(Intent intent, IntentState state) { 82 public IntentEvent setState(Intent intent, IntentState state) {
83 IntentId id = intent.id(); 83 IntentId id = intent.id();
84 states.put(id, state); 84 states.put(id, state);
85 - IntentEvent.Type type = (state == SUBMITTED ? IntentEvent.Type.SUBMITTED : 85 + IntentEvent.Type type = null;
86 - (state == INSTALLED ? IntentEvent.Type.INSTALLED : 86 +
87 - (state == FAILED ? IntentEvent.Type.FAILED : 87 + switch (state) {
88 - state == WITHDRAWN ? IntentEvent.Type.WITHDRAWN : 88 + case SUBMITTED:
89 - null))); 89 + type = IntentEvent.Type.SUBMITTED;
90 - return type == null ? null : new IntentEvent(type, intent); 90 + break;
91 + case INSTALLED:
92 + type = IntentEvent.Type.INSTALLED;
93 + break;
94 + case FAILED:
95 + type = IntentEvent.Type.FAILED;
96 + break;
97 + case WITHDRAWN:
98 + type = IntentEvent.Type.WITHDRAWN;
99 + break;
100 + default:
101 + break;
102 + }
103 + if (type == null) {
104 + return null;
105 + }
106 + return new IntentEvent(type, intent);
91 } 107 }
92 108
93 @Override 109 @Override
......