Skip to content

Commit

Permalink
Fix lint warning
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesa2 committed Oct 27, 2022
1 parent 6739206 commit 70d8b35
Showing 1 changed file with 33 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private static boolean isComponentConnection(BaseProduct.ComponentKey componentK
case CAMERA:
key = CameraKey.create(CameraKey.CONNECTION);
result = keyManager.getValue(key);
break;
case GIMBAL:
key = GimbalKey.create(GimbalKey.CONNECTION);
result = keyManager.getValue(key);
Expand Down Expand Up @@ -134,71 +135,67 @@ private static boolean isComponentConnection(BaseProduct.ComponentKey componentK
default:
break;
}
if (result instanceof Boolean && ((Boolean) result)) {
return true;
}

return false;
return result instanceof Boolean && ((Boolean) result);
}

protected static HashMap<BaseProduct.ComponentKey, ArrayList<String>> getSubComponentMap() {
HashMap<BaseProduct.ComponentKey, ArrayList<String>> subComponentMap = new HashMap<>();
subComponentMap.clear();
String subComponnetType;
String subComponentType;

ArrayList<String> flightControllerList = new ArrayList<>();
flightControllerList.clear();
flightControllerList.add("");
subComponnetType = FLIGHT_CONTROLLER_ACCESS_LOCKER;
if (isSubComponentConnection(subComponnetType)) {
flightControllerList.add(subComponnetType);
subComponentType = FLIGHT_CONTROLLER_ACCESS_LOCKER;
if (isSubComponentConnection(subComponentType)) {
flightControllerList.add(subComponentType);
}
subComponnetType = FLIGHT_CONTROLLER_FLIGHT_ASSISTANT;
if (isSubComponentConnection(subComponnetType)) {
flightControllerList.add(subComponnetType);
subComponentType = FLIGHT_CONTROLLER_FLIGHT_ASSISTANT;
if (isSubComponentConnection(subComponentType)) {
flightControllerList.add(subComponentType);
}
subComponentMap.put(BaseProduct.ComponentKey.FLIGHT_CONTROLLER, flightControllerList);

ArrayList<String> batteryList = new ArrayList<>();
batteryList.clear();
batteryList.add("");
subComponnetType = BATTERY_BATTERY_AGGREGATION;
if (isSubComponentConnection(subComponnetType)) {
batteryList.add(subComponnetType);
subComponentType = BATTERY_BATTERY_AGGREGATION;
if (isSubComponentConnection(subComponentType)) {
batteryList.add(subComponentType);
}
subComponentMap.put(BaseProduct.ComponentKey.BATTERY, batteryList);

ArrayList<String> airLinkList = new ArrayList<>();
airLinkList.clear();
airLinkList.add("");
subComponnetType = AIR_LINK_WIFI_LINK;
if (isSubComponentConnection(subComponnetType)) {
airLinkList.add(subComponnetType);
subComponentType = AIR_LINK_WIFI_LINK;
if (isSubComponentConnection(subComponentType)) {
airLinkList.add(subComponentType);
}
subComponnetType = AIR_LINK_LIGHT_BRIDGE;
if (isSubComponentConnection(subComponnetType)) {
airLinkList.add(subComponnetType);
subComponentType = AIR_LINK_LIGHT_BRIDGE;
if (isSubComponentConnection(subComponentType)) {
airLinkList.add(subComponentType);
}
subComponnetType = AIR_LINK_OCUSYNC_LINK;
if (isSubComponentConnection(subComponnetType)) {
airLinkList.add(subComponnetType);
subComponentType = AIR_LINK_OCUSYNC_LINK;
if (isSubComponentConnection(subComponentType)) {
airLinkList.add(subComponentType);
}
subComponentMap.put(BaseProduct.ComponentKey.AIR_LINK, airLinkList);

ArrayList<String> accessoryAggreationList = new ArrayList<>();
accessoryAggreationList.clear();
accessoryAggreationList.add("");
subComponnetType = ACCESSORY_AGGREGATION_BEACON;
if (isSubComponentConnection(subComponnetType)) {
accessoryAggreationList.add(subComponnetType);
subComponentType = ACCESSORY_AGGREGATION_BEACON;
if (isSubComponentConnection(subComponentType)) {
accessoryAggreationList.add(subComponentType);
}
subComponnetType = ACCESSORY_AGGREGATION_SPOTLIGHT;
if (isSubComponentConnection(subComponnetType)) {
accessoryAggreationList.add(subComponnetType);
subComponentType = ACCESSORY_AGGREGATION_SPOTLIGHT;
if (isSubComponentConnection(subComponentType)) {
accessoryAggreationList.add(subComponentType);
}
subComponnetType = ACCESSORY_AGGREGATION_SPEAKER;
if (isSubComponentConnection(subComponnetType)) {
accessoryAggreationList.add(subComponnetType);
subComponentType = ACCESSORY_AGGREGATION_SPEAKER;
if (isSubComponentConnection(subComponentType)) {
accessoryAggreationList.add(subComponentType);
}
subComponentMap.put(BaseProduct.ComponentKey.ACCESSORY_AGGREGATION, accessoryAggreationList);

Expand Down Expand Up @@ -255,10 +252,7 @@ private static boolean isSubComponentConnection(String subComponentType) {
break;
}

if (result instanceof Boolean && ((Boolean) result)) {
return true;
}
return false;
return result instanceof Boolean && ((Boolean) result);
}

protected static HashMap<BaseProduct.ComponentKey, ArrayList<Integer>> getComponentIndexMap() {
Expand All @@ -276,7 +270,7 @@ protected static HashMap<BaseProduct.ComponentKey, ArrayList<Integer>> getCompon

ArrayList<Integer> cameraIndexList = new ArrayList<>();
cameraIndexList.clear();
List<Camera> cameraList = ((Aircraft) product).getCameras();
List<Camera> cameraList = product.getCameras();
for (Camera camera : cameraList) {
cameraIndexList.add(camera.getIndex());
}
Expand All @@ -292,7 +286,7 @@ protected static HashMap<BaseProduct.ComponentKey, ArrayList<Integer>> getCompon

ArrayList<Integer> batteryIndexList = new ArrayList<>();
batteryIndexList.clear();
List<Battery> batteryList = ((Aircraft) product).getBatteries();
List<Battery> batteryList = product.getBatteries();
for (Battery battery : batteryList) {
batteryIndexList.add(battery.getIndex());
}
Expand Down

0 comments on commit 70d8b35

Please sign in to comment.