public List<WareHouse> getWareHouses() { List<WareHouse> res = new ArrayList<WareHouse>(); if (StringUtils.isNotBlank(this.projectWareHouse)) { String[] parts = this.projectWareHouse.split(","); for (String projectWareHousePart : parts) { WareHouse wareHouse = new WareHouse(); String[] wareHouseParts = projectWareHousePart.split("#"); wareHouse.setWareHouseCode(wareHouseParts[0]); wareHouse.setWareHouseName(wareHouseParts[1]); res.add(wareHouse); } } return res; }
public Map<String, WareHouse> getMonitorWareHouse() { Map<String, WareHouse> res = new HashMap<String, WareHouse>(); if (StringUtils.isNotBlank(monitorWarehouseCodeList) && StringUtils.isNotBlank(monitorWarehouseNameList)) { String[] codeParts = monitorWarehouseCodeList.split(","); String[] nameParts = monitorWarehouseNameList.split(","); for (int index = 0; index < codeParts.length && index < nameParts.length; index++) { WareHouse wareHouse = new WareHouse(); wareHouse.setWareHouseCode(codeParts[index]); wareHouse.setWareHouseName(nameParts[index]); res.put(codeParts[index], wareHouse); } } return res; }
public List<WareHouse> getWareHouses() { String[] wareHouseCodes = this.monitorWarehouseCodeList.split(","); String[] wareHouseNames = this.monitorWarehouseNameList.split(","); int size = wareHouseCodes.length < wareHouseNames.length ? wareHouseCodes.length : wareHouseNames.length; List<WareHouse> wareHouses = new ArrayList<WareHouse>(); for (int index = 0; index < size; index++) { WareHouse wareHouse = new WareHouse(); wareHouse.setWareHouseName(wareHouseNames[index]); wareHouse.setWareHouseCode(wareHouseCodes[index]); wareHouses.add(wareHouse); } return wareHouses; }
public User(String name, String email, String gsm, WareHouse warehouse) { this.setEmail(email); this.setGsm(gsm); if (!warehouse.equals(null)) { this.warehouse = warehouse; } }
private static void readFile(String name) { try { BufferedReader br = new BufferedReader(new FileReader(name)); String line; line = br.readLine(); String[] ints = line.split(" "); rows = Integer.parseInt(ints[0]); cols = Integer.parseInt(ints[1]); dronesCount = Integer.parseInt(ints[2]); turns = Integer.parseInt(ints[3]); maxLoad = Integer.parseInt(ints[4]); productTypes = Integer.parseInt(br.readLine()); productWeigths = new int[productTypes]; ints = br.readLine().split(" "); for (int i = 0; i < productTypes; i++) { productWeigths[i] = Integer.parseInt(ints[i]); } warehouseCount = Integer.parseInt(br.readLine()); warehouses = new ArrayList<>(); for (int i = 0; i < warehouseCount; i++) { ints = br.readLine().split(" "); WareHouse w = new WareHouse(i); w.x = Integer.parseInt(ints[0]); w.y = Integer.parseInt(ints[1]); ints = br.readLine().split(" "); for (int j = 0; j < productTypes; j++) { int n = Integer.parseInt(ints[j]); for (int k = 0; k < n; k++) w.products.add(new Product(j, productWeigths[j])); } warehouses.add(w); } orderCount = Integer.parseInt(br.readLine()); orders = new ArrayList<>(); for (int i = 0; i < orderCount; i++) { Order order = new Order(i); ints = br.readLine().split(" "); order.x = Integer.parseInt(ints[0]); order.y = Integer.parseInt(ints[1]); int n = Integer.parseInt(br.readLine()); ints = br.readLine().split(" "); for (int j = 0; j < n; j++) { int type = Integer.parseInt(ints[j]); order.products.add(new Product(type, productWeigths[type])); } orders.add(order); } for (int i = 0; i < dronesCount; i++) { drones.add(new Drone(warehouses.get(0).x, warehouses.get(0).y, i)); } while ((line = br.readLine()) != null) { System.out.println(line); } } catch (IOException e) { System.out.println("error reading file " + e.getMessage()); } }