import java.io.FileInputStream; /** HistoryFactsFile abstract class Object of this type are meant to encapsulate the actual source and stream from which the data comes. Methods are provided for clients to get information * from the object. * Concrete implementations should provide a constructor which opens a data source (such as a file) containing history information. * In project 2, because of the file format, clients should call * nextDate and nextFact in strict alternation. The implementation * is not required to enforce this. * * For Project 2, only ASCII text files need be processed. The required format * of those files is given in the project description. * However, there is nothing in the abstract class that requires such a format. */ public abstract class HistoryFactsFile { /** Changes from the original spec: the instannce variable is now private, * and is named dataSourceName instead of fileName */ protected String dataSourceName = "no file yet"; /** Change from the original spec: this instance variable removed. */ //protected FileInputStream fileStream = null; /**returns false if no more data is available; true otherwise */ public abstract boolean hasNext( ); /** After calling nextDate, a client should call nextFact before calling nextDate again */ public abstract String nextDate( ); //returns the next date line on the file /** After calling nextFact, a client should call nextDate before calling nextDate again */ public abstract String nextFact( ); //returns the next fact line on the file }