Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ro.tuc.dsrl.ds.handson.assig.three.queue.entities;
- import java.io.Serializable;
- public class DVD implements Serializable{
- private static final long serialVersionUID = 1L;
- private String title;
- private int year;
- private double price;
- public DVD(String title, int year, double price) {
- super();
- this.title = title;
- this.year = year;
- this.price = price;
- }
- public DVD() {
- }
- public String getTitle() {
- return title;
- }
- public int getYear() {
- return year;
- }
- public double getPrice() {
- return price;
- }
- public void setTitle(String title) {
- this.title = title;
- }
- public void setYear(int year) {
- this.year = year;
- }
- public void setPrice(double price) {
- this.price = price;
- }
- @Override
- public String toString() {
- return "DVD{" + "title='" + title + ", year=" + year + ", price=" + price + '}';
- }
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- long temp;
- temp = Double.doubleToLongBits(price);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- result = prime * result + ((title == null) ? 0 : title.hashCode());
- result = prime * result + year;
- return result;
- }
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- DVD other = (DVD) obj;
- if (Double.doubleToLongBits(price) != Double.doubleToLongBits(other.price))
- return false;
- if (title == null) {
- if (other.title != null)
- return false;
- } else if (!title.equals(other.title))
- return false;
- if (year != other.year)
- return false;
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement