Skip to content
Snippets Groups Projects
Commit 004fb22d authored by Ray Liu's avatar Ray Liu
Browse files

Added documentation to Date and Histogram

parent 015ea501
No related branches found
No related tags found
No related merge requests found
package data;
import java.io.Serializable;
public class Date implements Comparable<Date>, Serializable {
/**
*
* Date ADT for Records
*/
public class Date implements Comparable<Date>, Serializable {
private static final long serialVersionUID = -5256185778691324647L;
private final int year;
private final int month;
private final int day;
/**
* Initializes the object
*/
public Date (int year, int month, int day) {
this.year= year;
this.month= month;
......@@ -18,20 +21,38 @@ public class Date implements Comparable<Date>, Serializable {
}
/**
* Gets the year
*
* @return The year of the date
*/
public int getYear() {
return this.year;
}
/**
* Gets the month
*
* @return The month of the date
*/
public int getMonth() {
return this.month;
}
/**
* Gets the day
*
* @return The day of the date
*/
public int getDay() {
return this.day;
}
/**
* Gets the day
* @param other -date object that it's comparing to
* @return comparedToValue -1 if greater, -1 if smaller and 0 if equal
*/
public int compareTo(Date other) {
if (this.year > other.getYear()) return 1;
......
......@@ -29,6 +29,11 @@ public class Histogram {
return tree;
}
/**
* Prints a histogram based on a BST of records
*
* @param record -An BST of records
*/
public static void printHistogram(BST<Integer,Integer> record) {
int max = 0;
int scale = 100;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment