/**
 * CS 240: Introduction to Data Structures
 * Professor: Edwin Rodr&iacute;guez
 * 
 * Programming Assignment #5
 * 
 * Assignment #5 is meant to grant a thorough understanding of the hash table
 * data structure, the hash functions used by hash tables, as well as the stack
 * and queue data structures. Expected is an implementation of a hash table able
 * to utilize different hash functions, an implementation of a 'scrambled' version
 * of rotational hashing using a stack and a queue, and a simple program which
 * uses a hash table as a registry of student records.
 * 
 * Carlos Marquez
 */

package edu.cpp.cs.cs240.prog_assgnmnt_5;

public class Student implements Comparable<Student> {
	private String ID;
	private String name;
	private String grade;
	
	Student(String ID, String name, String grade) {
		this.ID = ID;
		this.name = name;
		this.grade = grade;
	}
	
	public String getID() {
		return this.ID;
	}
	
	public String getKey() {
		return this.ID;
	}
	
	public String getName() {
		return this.name;
	}
	
	public String getGrade() {
		return this.grade;
	}
	
	@Override
	public boolean equals(Object o) {
		if (o.getClass() != String.class) { //if o is not a String (key not passed)
			Student s = (Student) o;
			if ((this.ID.equals(s.getID())) && (this.name.equals(s.getName())) && (this.grade.equals(s.getGrade()))) {
				return true;
			}
		}
		if (o.getClass() == String.class) { //a key was passed as argument
			if (this.getID().equals(o)) {
				return true;
			}
		}
		return false;
	}
	

	@Override
	public int compareTo(Student s) {
		String ID1 = this.ID;
		String ID2 = s.ID;
		
		return ID1.compareTo(ID2);
	}
}