public boolean deleteLastShelf() { if (list.size() <= 0) { return false; } StoreLocation last = list.get(list.size() - 1); int row = last.getRow(); int shelf = last.getShelf(); list.removeIf( cell -> { return cell.getRow() == row && cell.getShelf() == shelf; }); return true; }
public ArrayList<String> getShelfLabel() { ArrayList<String> result = new ArrayList<String>(); for (StoreLocation tmp : list) { if (result.indexOf(tmp.getRow() + "-" + tmp.getShelf()) == -1) result.add(tmp.getRow() + "-" + tmp.getShelf()); } return result; }
public StoreLocation getByPosition(int rowID, int shelf, int position) { for (StoreLocation tmp : list) { if (tmp.getRow() == rowID && tmp.getShelf() == shelf && tmp.getPosition() == position) return tmp; } return null; }
public ArrayList<StoreLocation> getByShelf(int rowID, int shelf) { ArrayList<StoreLocation> result = new ArrayList<StoreLocation>(); for (StoreLocation tmp : list) { if (tmp.getRow() == rowID && tmp.getShelf() == shelf) result.add(tmp); } return result; }
public int getShelfNumber() { if (list.size() == 0) { return 0; } StoreLocation last = list.get(list.size() - 1); int lastShelf = last.getShelf(); return lastShelf; }
public boolean addShelf() { StoreLocation last = list.get(list.size() - 1); int shelf = last.getShelf(); int row = last.getRow(); if (shelf == 50) { row++; shelf = 1; } else { shelf++; } for (int i = 0; i < shelfForEachRow; i++) { this.list.add(new StoreLocation(areaType, row, shelf, i + 1)); } return true; }