/**
 * 2402Assignment1.java
 *
 * Caitlin Ross
 * 100735219
 */
 
class Entry extends Object {
	
	//Fields
	private int columnNumber;
	private int value;
	private Entry nextEntry;
	
	
	//Constructors
	
	//Creates a blank, zeroed Entry
	public Entry(){
		columnNumber = 0;
		value = 0;
		nextEntry = null;
	}
	
	//Creates an entry with the value 0
	public Entry(int colNum, Entry next){
		columnNumber = colNum;
		value = 0;
		nextEntry = next;
	}
	
	//Deep copies an Entry
	public Entry(Entry anEntry){
		columnNumber = anEntry.columnNumber;
		value = anEntry.value;
		
		//Check if anEntry.nextEntry is null before setting nextEntry
		if(anEntry.nextEntry != null)
			nextEntry = new Entry(anEntry.nextEntry);
		else
			nextEntry = null;
	}
	
	
	//Accessors
	
	//Returns the value of the Entry
	public int getValue(){
		return value;
	}
	
	//Returns the column number of the Entry
	public int getColumnNumber(){
		return columnNumber;
	}
	
	//Returns the next Entry in the Row
	public Entry getNext(){
		return nextEntry;
	}
	
	//Displays the Entry as (columnNumber, value)
	public void display(){
		System.out.print("(" + columnNumber + ", " + value + ")");
	}
	
	
	//Modifiers
	
	//Sets the value of the Entry
	public void setValue(int aValue){
		value = aValue;
	}
	
	//Sets the Entry pointed to by this Entry
	public void setNext(Entry next){
		nextEntry = next;
	}
	
}
