Skip to content

Commit b271c26

Browse files
committed
some clean code.
1 parent ff1204a commit b271c26

22 files changed

+281
-174
lines changed

.idea/workspace.xml

Lines changed: 138 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/app.iml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/apk_list" />
9090
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
9191
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" />
92+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
9293
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundle_manifest" />
9394
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check_manifest_result" />
9495
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" />

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@
5454
<activity
5555
android:name=".AlviiMain"
5656
android:label="ALVIi"
57+
android:theme="@style/DialogPopUp"
5758
android:screenOrientation="portrait">
5859
<intent-filter>
5960
<action android:name="android.intent.action.MAIN" />
60-
6161
<category android:name="android.intent.category.LAUNCHER" />
6262
</intent-filter>
6363
</activity>

app/src/main/java/pt/lsts/accl/bus/AcclBus.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,8 @@ public static boolean sendMessageToAllUUVs(IMCMessage msg){
280280
* @see pt.lsts.imc.IMCMessage
281281
*/
282282
public static boolean isMsgFromMain(IMCMessage imcMessage){
283-
if (imcMessage.getSrc()==mainSys.getID())
284-
return true;
285-
return false;
286-
}
283+
return imcMessage.getSrc() == mainSys.getID();
284+
}
287285

288286
/**
289287
*

app/src/main/java/pt/lsts/accl/sys/Sys.java

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -199,49 +199,38 @@ public void setLastMsgReceived(IMCMessage lastMsgReceived) {
199199
* @return true if same system, false otherwise
200200
*/
201201
public boolean equals(Sys sys){
202-
if (sys.getID()==this.getID())
203-
return true;
204-
return false;
202+
return sys.getID() == this.getID();
205203
}
206204

207205
/**
208206
* Check if the system is a vehicle.
209207
* @return true if SYS_TYPE = UUV, USV, UAV or UGV, false otherwise
210208
**/
211209
public boolean isVehicle(){
212-
if (getSysType()==
210+
return getSysType() ==
213211
SystemType.UUV
214-
|| getSysType()==
212+
|| getSysType() ==
215213
SystemType.USV
216-
|| getSysType()==
214+
|| getSysType() ==
217215
SystemType.UAV
218-
|| getSysType()==
219-
SystemType.UGV)
220-
return true;
221-
else
222-
return false;
216+
|| getSysType() ==
217+
SystemType.UGV;
223218
}
224219

225220
/**
226221
* Check if the system is a Unmanned Aerial Vehicle (UAV).
227222
* @return true if SYS_TYPE = UAV, false otherwise
228223
**/
229224
public boolean isUAV(){
230-
if (getSysType()== SystemType.UAV){
231-
return true;
232-
}
233-
return false;
225+
return getSysType() == SystemType.UAV;
234226
}
235227

236228
/**
237229
* Check if the system is a Unmanned Underwater Vehicle (UUV), also refered to as Autonomous Underwater Vehicle (AUV) or Light AUV (LAUV).
238230
* @return true if SYS_TYPE = UUV, false otherwise
239231
**/
240232
public boolean isUUV(){
241-
if (getSysType()== SystemType.UUV){
242-
return true;
243-
}
244-
return false;
233+
return getSysType() == SystemType.UUV;
245234
}
246235

247236
/**
@@ -250,10 +239,7 @@ public boolean isUUV(){
250239
* @return true if SYS_TYPE = CCU, false otherwise
251240
**/
252241
public boolean isCCU(){
253-
if (getSysType()== SystemType.CCU){
254-
return true;
255-
}
256-
return false;
242+
return getSysType() == SystemType.CCU;
257243
}
258244

259245
/**
@@ -262,9 +248,7 @@ public boolean isCCU(){
262248
* @return false if more than 10 seconds since last Message, true otherwise.
263249
*/
264250
public boolean isConnected(){
265-
if (getLastMsgReceivedAgeInSeconds()>10)
266-
return false;
267-
return true;
251+
return !(getLastMsgReceivedAgeInSeconds() > 10);
268252
}
269253

270254
}

app/src/main/java/pt/lsts/accl/util/IMCUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ public static ArrayList<String> getAnnounceService(IMCMessage msg,
3030
String service) {
3131
String str = msg.getString("services");
3232
ArrayList<String> list = new ArrayList<String>();
33-
String services[] = str.split(";");
33+
String[] services = str.split(";");
3434
for (String s : services) {
35-
String foo[] = s.split("://");
35+
String[] foo = s.split("://");
3636
if (foo[0].equals(service))
3737
list.add(foo[1]);
3838
}
@@ -47,9 +47,9 @@ public static ArrayList<String> getAnnounceService(IMCMessage msg,
4747
* @return The node address for IMC communications.
4848
*/
4949
public static String[] getAnnounceIMCAddressPort(IMCMessage msg) {
50-
String res[]=null;
50+
String[] res = null;
5151
for (String s : getAnnounceService(msg, "imc+udp")) {
52-
String foo[] = s.split(":");
52+
String[] foo = s.split(":");
5353
res = new String[2];
5454
res[0] = foo[0];
5555
res[1] = foo[1].substring(0, foo[1].length() - 1);

app/src/main/java/pt/lsts/alvii/AcclBusListenner.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,7 @@ public boolean isRunnigPlan(String sysName, String planName){
502502
for (int i = 0; i < number_system; i++) {
503503
if (m_system_Info.system_names[i].equals(sysName)) {
504504
if(m_system_Info.planInfoRun[i][0].equals(planName)){
505-
if(m_system_Info.planInfoRun[i][1].equals("EXECUTING"))
506-
return true;
507-
else
508-
return false;
505+
return m_system_Info.planInfoRun[i][1].equals("EXECUTING");
509506
}
510507
}
511508
}

0 commit comments

Comments
 (0)