private Event event1 = null; // asocjacja binarna licznosc 0...1 public MainHall(Estate estate) { if (estate == null || !Estate.getEstates().Contains(estate)) { throw new Exception("Estate can't be null"); } counter++; setEvent(null); setHallId(counter); setEstate(estate); halls.Add(this); }
public MainHall(Estate estate, Event event1) { if (estate == null || !Estate.getEstates().Contains(estate)) { throw new Exception("Estate can't be null"); } counter++; setHallId(counter); if (event1.getHall() != null) { event1.getHall().setEvent(null); // oznaczenie jako puste setEvent(event1); setEstate(estate); halls.Add(this); } }