Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. package ro.tuc.dsrl.ds.handson.assig.three.queue.entities;
  2.  
  3. import java.io.Serializable;
  4.  
  5. public class DVD implements Serializable{
  6.  
  7. private static final long serialVersionUID = 1L;
  8. private String title;
  9. private int year;
  10. private double price;
  11.  
  12.  
  13. public DVD(String title, int year, double price) {
  14. super();
  15. this.title = title;
  16. this.year = year;
  17. this.price = price;
  18. }
  19.  
  20. public DVD() {
  21. }
  22.  
  23. public String getTitle() {
  24. return title;
  25. }
  26.  
  27. public int getYear() {
  28. return year;
  29. }
  30.  
  31. public double getPrice() {
  32. return price;
  33. }
  34.  
  35. public void setTitle(String title) {
  36. this.title = title;
  37. }
  38.  
  39. public void setYear(int year) {
  40. this.year = year;
  41. }
  42.  
  43. public void setPrice(double price) {
  44. this.price = price;
  45. }
  46.  
  47. @Override
  48. public String toString() {
  49. return "DVD{" + "title='" + title + ", year=" + year + ", price=" + price + '}';
  50. }
  51.  
  52. @Override
  53. public int hashCode() {
  54. final int prime = 31;
  55. int result = 1;
  56. long temp;
  57. temp = Double.doubleToLongBits(price);
  58. result = prime * result + (int) (temp ^ (temp >>> 32));
  59. result = prime * result + ((title == null) ? 0 : title.hashCode());
  60. result = prime * result + year;
  61. return result;
  62. }
  63.  
  64. @Override
  65. public boolean equals(Object obj) {
  66. if (this == obj)
  67. return true;
  68. if (obj == null)
  69. return false;
  70. if (getClass() != obj.getClass())
  71. return false;
  72. DVD other = (DVD) obj;
  73. if (Double.doubleToLongBits(price) != Double.doubleToLongBits(other.price))
  74. return false;
  75. if (title == null) {
  76. if (other.title != null)
  77. return false;
  78. } else if (!title.equals(other.title))
  79. return false;
  80. if (year != other.year)
  81. return false;
  82. return true;
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement