import java.io.*;
import java.util.*;

/**
 * A class for reading StockQuotation information
 * from a BufferedReader
 *
 *
 * @version 1.0
 * @author  Prof. David Bernstein, James Madison University
 *
 */
 public class StockReader extends SecurityReader
 {
 
    protected TickerSymbol     symbol;

    /**
     * Construct a new StockReader
     *
     * @param reader   The BufferedReader to use
     * @param symbol   The ticker symbol of the stock
     */
     public StockReader(BufferedReader reader, TickerSymbol symbol)
     {
			super(reader);
	    	this.symbol = symbol;
     }

    /**
     * Read an entry
     */
     public SecurityQuotation readSecurity()  throws IOException,
                                             NoSuchElementException,
                                             NumberFormatException
     {   
	      
	  		String      	line;
			StockQuotation	tempStockQuotation;

			line = reader.readLine();
			if (line == null) 
				return null;

			tempStockQuotation = StockQuotation.parseStockQuotation(symbol, line);
			return tempStockQuotation;
    }

} // end StockReader
