WaterData.java [src/WaterData] Revision: default Date:
package WaterData;
/**
* Last Updated: 15-January-2019
* @author Tyler Wible
* @since 25-January-2014
*/
public class WaterData {
/**
* Initializes a data source based on the provided database name
* @param database the name of the water data source desired (CDSN, CDWR, STORET, 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 WaterDataInterface for the appropriate data source, or null
*/
public static WaterDataInterface getNewWaterDataInterface(String database, String userData){
WaterDataInterface dataSource = null;
if(database.equalsIgnoreCase("CDSN")){
dataSource = new WaterData_CDSN();
}else if(database.equalsIgnoreCase("CDWR")){
dataSource = new WaterData_CDWR();
}else if(database.equalsIgnoreCase("STORET")){
dataSource = new WaterData_WqDataPortal();
}else if(database.equalsIgnoreCase("STORET-narrow")){
dataSource = new WaterData_WqDataPortal_narrow();
}else if(database.equalsIgnoreCase("USGS")){
dataSource = new WaterData_USGS();
}else if(database.equalsIgnoreCase("UserData")){
dataSource = new WaterData_User(userData);
}
return dataSource;
}
}