我有這些代碼:如何查找並計算特定類型的空間數量?
public class CentroImpl implements Centro {
//Atributos
private String nombre;
private String direccion;
private Integer numeroPlantas;
private Integer numeroSotanos;
public Set<Espacio> espacio;
//Constructor
public CentroImpl(String nombre, String direccion, Integer numeroPlantas, Integer numeroSotanos){
checkPlantas(numeroPlantas);
checkSotanos(numeroSotanos);
this.nombre = nombre;
this.direccion = direccion;
this.numeroPlantas = numeroPlantas;
this.numeroSotanos = numeroSotanos;
this.espacio = new TreeSet<Espacio>();
}
@Override
public Set<Despacho> getDespachos() {
}
getDespacho
應該要經過「Espacios」建築物(炫酷)(地區)的名單,並告訴我,有多少人是Despachos
(辦事處)。正如你在Espacio class
中看到的那樣,有一種類型被定義。
public class EspacioImpl implements Espacio {
//Atributos
private TipoEspacio tipo;
private String nombre;
private Integer planta;
private Integer aforo;
//Constructores
public EspacioImpl(TipoEspacio tipo, String nombre, Integer planta, Integer aforo) {
checkerAforo(aforo);
this.nombre = nombre;
this.planta = planta;
this.aforo = aforo;
this.tipo = tipo;
}
但我還沒有學會如何訪問它,我一直沒能找到任何可以理解的東西。感謝您的幫助。
'TipoEspacio'是一個'enum'嗎? – Daniel
是的,它是@丹尼爾 –
我在想這裏有一些設計缺陷。 「Espacio」界面是什麼樣的? – Daniel