GroundwaterData.java [src/WaterData] Revision: default  Date:
package WaterData;

/**
* Last Updated: 20-November-2018
* @author Tyler Wible
* @since 21-June-2017
*/
public class GroundwaterData {
    /**
     * Initializes a data source based on the provided database name
     * @param database  the name of the water data source desired (USGS, UserData)
     * @param userData  **can be null unless database == UserData** The tab-delimited string of user data with header  
     * The expected format of the string is a tab-delimited text file 
     * (\n separating lines) with dates in the first column and daily 
     * average cfs values in the second column (\t separating columns).  
     * (Acceptable date formats for the first column are:
     * yyyy-mm-dd, 
     * yyyy-mm-d, 
     * yyyy-m-dd, 
     * yyyy-m-d, 
     * yyyy/mm/dd, 
     * yyyy/mm/d, 
     * yyyy/m/dd, 
     * yyyy/m/d)
     * (ex. "Date\tFlow\n1999-04-29\t8.3\n1999-05-09\t60.2\n1999-05-29\t20.1")
     * @return a GroundwaterDataInterface for the appropriate data source, or null
     */
    public static GroundwaterDataInterface getNewGroundwaterDataInterface(String database, String userData){
        GroundwaterDataInterface dataSource = null;
        if(database.equalsIgnoreCase("USGS")){
            dataSource = new GroundwaterData_USGSWell();
        }else if(database.equalsIgnoreCase("UserData")){
            dataSource = new GroundwaterData_User(userData);
        }
        return dataSource;
    }
}