/
nikolay470
/
algorithm_implementation
Обзор
Документация
Войти
/
nikolay470
/
algorithm_implementation
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/main/java/ru/gitflic/classes/PrintedRack.java
57 строк
1 KB
nikolay94
Добавление функционала: написал логику отбора остатков из зоны отбора.
15 июн 2026, 09:30
15 июн 2026, 09:30
734d1e7
Код
Авторство
О чём код?
package ru.gitflic.classes; import ru.gitflic.exceptions.InvalidFormat; import java.util.HashMap; public class PrintedRack { public final int hall; public int number; public int quantTiers; public int quantPlacesInTier; public HashMap<String, PrintedCell> cells; public PrintedRack( int hall, int number, int quantTiers, int quantPlacesInTier ) { this.hall = hall; this.number = number; this.quantTiers = quantTiers; this.quantPlacesInTier = quantPlacesInTier; this.cells = new HashMap<>( quantTiers * quantPlacesInTier ); } public void init() { String addressStr; for ( int i = 0; i < quantTiers; i++ ) { for ( int j = 0; j < quantPlacesInTier; j++ ) { addressStr = this.hall + "-" + this.number + "-" + i + "-" + j;; try { this.cells.put(addressStr, new PrintedCell(Address.ofString(addressStr))); } catch ( InvalidFormat e ) { System.out.println("Адрес в виде строки в некорректном формате."); } } } } public String toString() { return String.format( "Стеллаж №%d, зал %d", this.number, this.hall ); } public boolean equals( PrintedRack other ) { if ( other == null ) { return false; } return ( this.hall == other.hall && this.number == other.number ); } }