让我向您解释我实际上要实现的目标。
我要根据街道列出不同类型的停车位。假设我有一个街道名称,即abc,并且该街道可以包含以下
的组合停车类型(老年人,残疾人,摩托车手,卡车,特许, 常规)
并且基于包含停车位类型,我需要在地图上显示不同的标记。
我尝试过的事情: 我尝试将其与所有停车类型(即6!= 720)组合使用,如果我使用它,我需要做720个测试用例,并且变得太长
firebase的响应:parking_space键包含不同停车类型的列表
此方法将要求通过该街道上所有可用的停车类型从firebase和迭代器获取数据,并将类型设置为true and vice versa
private ArrayList<ParkingTypePojo> parkingTypeListPojo = new ArrayList<>();
private ParkingTypePojo parkingTypePojo;
private void evaluateMarkerType(ArrayList<Map<String, Object>> pack) {
boolean elderlyStatus = false;
boolean disabledStatus = false;
boolean cyclistStatus = false;
boolean motorcyclistStatus = false;
boolean truckStatus = false;
boolean charteredStatus = false;
boolean conventionalStatus = false;
for (int i = 0; i < pack.size(); i++) {
switch (pack.get(i).get(Constants.PARKING_TYPE).toString()) {
case "Elderly"://normal green
//1
elderlyStatus = true;
break;
case "Disabled"://senior disable blue
//2
disabledStatus = true;
break;
case "Cyclist"://cycle orange
//3
cyclistStatus = true;
break;
case "Motorcyclist"://moto prpl
//4
motorcyclistStatus = true;
break;
case "Truck"://truck yllw
//5
truckStatus = false;
break;
case "Chartered"://cet black
//6
charteredStatus = true;
break;
case "Conventional"://zona blue money
//7
conventionalStatus = true;
break;
default:
break;
}
}
parkingTypePojo = new ParkingTypePojo(elderlyStatus, disabledStatus, cyclistStatus, motorcyclistStatus, truckStatus, charteredStatus, conventionalStatus);
parkingTypeListPojo.add(parkingTypePojo);
}
我在pojo类中存储了基于街道的停车类型
public class ParkingTypePojo {
private boolean elderlyStatus;
private boolean disabledStatus;
private boolean cyclistStatus;
private boolean motorcyclistStatus;
private boolean truckStatus;
private boolean charteredStatus;
private boolean conventionalStatus;
public ParkingTypePojo(boolean elderlyStatus, boolean disabledStatus, boolean cyclistStatus, boolean motorcyclistStatus, boolean truckStatus, boolean charteredStatus, boolean conventionalStatus) {
this.elderlyStatus = elderlyStatus;
this.disabledStatus = disabledStatus;
this.cyclistStatus = cyclistStatus;
this.motorcyclistStatus = motorcyclistStatus;
this.truckStatus = truckStatus;
this.charteredStatus = charteredStatus;
this.conventionalStatus = conventionalStatus;
}
public boolean isElderlyStatus() {
return elderlyStatus;
}
public boolean isDisabledStatus() {
return disabledStatus;
}
public boolean isCyclistStatus() {
return cyclistStatus;
}
public boolean isMotorcyclistStatus() {
return motorcyclistStatus;
}
public boolean isTruckStatus() {
return truckStatus;
}
public boolean isCharteredStatus() {
return charteredStatus;
}
public boolean isConventionalStatus() {
return conventionalStatus;
}
}
请提出其他解决组合问题的方法。谢谢