This repository acts as a personal archive for my solutions to EdX course *Data Structures and Software Design* from PennX.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

53 lines
1.1 KiB

import java.util.Date;
import java.util.Set;
import java.util.HashSet;
public abstract class Document {
private String title;
private String author;
private Date date;
private PublishingLocation publishingLocation;
public Document(String title, String author, Date date, String city, String state, String postCode){
this.title = title;
this.author = author;
this.date = date;
this.publishingLocation = new PublishingLocation(city, state, postCode);
}
public String getTitle() {
return title;
}
public String getAuthor() {
return author;
}
public Date getDate() {
return date;
}
public boolean sameAuthor(Document article){
return this.author.equals(article.author);
}
public int compareDates(Document article){
return this.date.compareTo(article.date);
}
public int compareWithGeneralDate(Date date){
return this.date.compareTo(date);
}
public String getCity() {
return publishingLocation.getCity();
}
public String getState() {
return publishingLocation.getState();
}
public String getPostCode() {
return publishingLocation.getPostCode();
}
}