/home/caleb/ASDV-Java/Semester 2/Exams/Exam2-Practice_CalebFontenot/src/main/java/com/calebfontenot/exam2/practice_calebfontenot/Automobile.java |
nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
package com.calebfontenot.exam2.practice_calebfontenot;
import java.util.Objects;
@author
public class Automobile implements Comparable<Automobile> {
private String vin;
private CountryOfOrigin origin;
public Automobile(String vin, CountryOfOrigin origin)
{
this.vin = vin;
this.origin = origin;
}
public CountryOfOrigin getOrigin()
{
return origin;
}
public void setOrigin(CountryOfOrigin origin)
{
this.origin = origin;
}
public String getVin()
{
return vin;
}
public void setVin(String vin)
{
this.vin = vin;
}
@Override
public String toString()
{
return "Automobile{" + "vin=" + vin + ", origin=" + origin + '}';
}
@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Automobile other = (Automobile) obj;
if (!Objects.equals(this.vin, other.vin)) {
return false;
}
return Objects.equals(this.origin, other.origin);
}
@Override
public int compareTo(Automobile o)
{
return vin.compareTo(o.vin);
}
}