PIbd-21_Potapov_N.S._Stormt.../ProjectStormtrooper/PlanesGenericStorage.java

43 lines
1.3 KiB
Java
Raw Normal View History

2023-10-24 12:50:32 +04:00
package ProjectStormtrooper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class PlanesGenericStorage {
final HashMap<String, PlanesGenericCollection<DrawingPlane, DrawingObjectPlane>> _planeStorages;
public List<String> Keys() {
return _planeStorages.keySet().stream().toList();
2023-10-24 12:50:32 +04:00
}
private final int _pictureWidth;
private final int _pictureHeight;
public PlanesGenericStorage(int pictureWidth, int pictureHeight) {
_planeStorages = new HashMap<>();
_pictureWidth = pictureWidth;
_pictureHeight = pictureHeight;
}
public void AddSet(String name) {
_planeStorages.put(name, new PlanesGenericCollection<>(_pictureWidth, _pictureHeight));
}
public void DelSet(String name) {
_planeStorages.remove(name);
}
public PlanesGenericCollection<DrawingPlane, DrawingObjectPlane> Get(String ind) {
if (_planeStorages.containsKey(ind))
return _planeStorages.get(ind);
return null;
}
public DrawingObjectPlane GetByDoubleParameter(String storageName, int planeIndex) {
if (_planeStorages.containsKey(storageName)) {
return _planeStorages.get(storageName).GetU(planeIndex);
}
return null;
}
2023-10-24 12:50:32 +04:00
}