Advertisement
AleksaLjujic

Park

Feb 10th, 2023
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. package park;
  2.  
  3. import java.util.Arrays;
  4. import java.util.Objects;
  5.  
  6. import park.izuzeci.ParkException;
  7.  
  8. public class Park {
  9. private SpravaZaZabavu[] sprave;
  10. private String adresa;
  11.  
  12. public SpravaZaZabavu[] getSprave() {
  13. return sprave;
  14. }
  15. public void setSprave(SpravaZaZabavu[] sprave) {
  16. this.sprave = sprave;
  17. }
  18. public String getAdresa() {
  19. return adresa;
  20. }
  21. public void setAdresa(String adresa) {
  22. if(adresa == null || adresa.isEmpty())
  23. throw new ParkException("Greska");
  24. this.adresa = adresa;
  25. }
  26.  
  27. public Park(SpravaZaZabavu[] sprave,String adresa) {
  28. this.sprave=sprave;
  29. this.adresa=adresa;
  30. }
  31. @Override
  32. public String toString() {
  33. if(sprave==null) {
  34. return "NEMA SPRAVA";
  35. }
  36. return "Park [sprave=" + Arrays.toString(sprave) + ", adresa=" + adresa + "]";
  37. }
  38.  
  39. @Override
  40. public boolean equals(Object obj) {
  41. if (this == obj)
  42. return true;
  43. if (obj == null)
  44. return false;
  45. if (getClass() != obj.getClass())
  46. return false;
  47. Park other = (Park) obj;
  48. return Objects.equals(adresa, other.adresa) && Arrays.equals(sprave, other.sprave);
  49. }
  50.  
  51.  
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement