/*-------------------------------------------------------------------------
 * File Name: Output.java
 * Author:    Lantian Zheng
 * Date:	  4/4/99
 * Purpose:  This class is basically a two-dimension array in which the data
 *	of a skip-list can be stored. 
 * Notes: our test program will check the stored skip-list. Students should 
 *	implement the "output" function in SkipListInterface. 
 *-------------------------------------------------------------------------*/

import java.util.Vector;

public class OutputList{
	private int NumLevels;
	private Vector[] Level;
		
	//--------------------------------------------------------------------------------
	//Function Name: OutputList
	//
	//Purpose: construct function
	//
	//Parameter
	//	NumLevels : the number of levels of your skip-list
	//--------------------------------------------------------------------------------
	public OutputList(int NumLevels) {
		this.NumLevels = NumLevels;
		Level = new Vector[NumLevels];
		int i;
		for (i=0;i<NumLevels;i++) {
			Level[i] = new Vector();
		}
	}
	
	//--------------------------------------------------------------------------------
	//Function Name: AddElement
	//
	//Purpose: add an element to the vector representing a specific level of skip-list
	//
	//Parameters
	//	levelIndex : the index of the specific level
	//	value :	the value of the element to be added
	//
	//Notes: elements should be added in order
	//--------------------------------------------------------------------------------
	public void AddElement(int levelIndex, int value) {
		Level[levelIndex].addElement(new Integer(value));
	}
	
	//--------------------------------------------------------------------------------
	//Function Name: ElementAt
	//Purpose: return the value of an element
	//--------------------------------------------------------------------------------
	public int ElementAt(int levelIndex, int loc) {
		return ((Integer)Level[levelIndex].elementAt(loc)).intValue();
	}
}	
	