Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package park;
- import java.util.Arrays;
- import java.util.Objects;
- import park.izuzeci.ParkException;
- public class Park {
- private SpravaZaZabavu[] sprave;
- private String adresa;
- public SpravaZaZabavu[] getSprave() {
- return sprave;
- }
- public void setSprave(SpravaZaZabavu[] sprave) {
- this.sprave = sprave;
- }
- public String getAdresa() {
- return adresa;
- }
- public void setAdresa(String adresa) {
- if(adresa == null || adresa.isEmpty())
- throw new ParkException("Greska");
- this.adresa = adresa;
- }
- public Park(SpravaZaZabavu[] sprave,String adresa) {
- this.sprave=sprave;
- this.adresa=adresa;
- }
- @Override
- public String toString() {
- if(sprave==null) {
- return "NEMA SPRAVA";
- }
- return "Park [sprave=" + Arrays.toString(sprave) + ", adresa=" + adresa + "]";
- }
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Park other = (Park) obj;
- return Objects.equals(adresa, other.adresa) && Arrays.equals(sprave, other.sprave);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement