Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. package osv.model.content.playershops;
  2.  
  3. public class ShopItem {
  4.  
  5. private final int amount;
  6.  
  7. private final int cost;
  8.  
  9. private final int id;
  10.  
  11. public ShopItem(int id, int amount, int cost) {
  12. super();
  13. this.id = id;
  14. this.amount = amount;
  15. this.cost = cost;
  16. }
  17.  
  18. @Override
  19. public boolean equals(Object obj) {
  20. if (this == obj)
  21. return true;
  22. if (obj == null)
  23. return false;
  24. if (getClass() != obj.getClass())
  25. return false;
  26. ShopItem other = (ShopItem) obj;
  27. if (id != other.id)
  28. return false;
  29. return other.amount >= amount;
  30. }
  31.  
  32. public int getAmount() {
  33. return amount;
  34. }
  35.  
  36. public int getCost() {
  37. return cost;
  38. }
  39.  
  40. public int getId() {
  41. return id;
  42. }
  43.  
  44. @Override
  45. public int hashCode() {
  46. final int prime = 31;
  47. int result = 1;
  48. result = prime * result + amount;
  49. result = prime * result + cost;
  50. result = prime * result + id;
  51. return result;
  52. }
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement