public class CodingCompCSVUtil
+extends java.lang.Object
+| Constructor and Description | +
|---|
CodingCompCSVUtil() |
+
| Modifier and Type | +Method and Description | +
|---|---|
int |
+countImpactfulYearsWithReportedIncidentsWithinRange(java.util.List<java.util.List<java.lang.String>> records,
+ int min,
+ int max)
+This method will return the count if the number of incident falls within the provided range.
+ |
+
boolean |
+firstRecordsHaveMoreReportedIndicents(java.util.List<java.util.List<java.lang.String>> records1,
+ java.util.List<java.util.List<java.lang.String>> records2)
+Determines if the first records has more reported incidents
+ |
+
void |
+generateRFile(java.util.List<java.util.List<java.lang.String>> records)
+Hacky way to generate an R file that creates a bar graph of the data
+ (I dont know R)
+ |
+
DisasterDescription |
+getMostImpactfulDisasterByYear(java.lang.String year,
+ java.util.List<java.util.List<java.lang.String>> records)
+Gets the most impactful disaster based upon a given year
+ |
+
DisasterDescription |
+getMostImpactfulYear(java.util.List<java.util.List<java.lang.String>> records)
+Reads through a given list of records to find the most impactful year in terms
+ of number of incidents, processing it as a DisasterDescription object.
+ |
+
DisasterDescription |
+getMostImpactfulYearByCategory(java.lang.String category,
+ java.util.List<java.util.List<java.lang.String>> records)
+Gets the most impactful year based upon natural disaster category
+ |
+
DisasterDescription |
+getTotalReportedIncidentsByCategory(java.lang.String category,
+ java.util.List<java.util.List<java.lang.String>> records) |
+
java.util.List<java.lang.String> |
+printDisastersByYear(java.util.List<java.util.List<java.lang.String>> records,
+ java.lang.String year)
+Generates a list of disasters that occured within a given year
+ |
+
java.util.List<java.util.List<java.lang.String>> |
+readCSVFileByCountry(java.lang.String fileName,
+ java.lang.String countryName)
+Reads and parses a CSV file in order to collect natural disaster data about
+ a specified country
+ |
+
java.util.List<java.util.List<java.lang.String>> |
+readCSVFileWithHeaders(java.lang.String fileName)
+Parses a CSV file and stores the data line by line, including the headers
+ |
+
java.util.List<java.util.List<java.lang.String>> |
+readCSVFileWithoutHeaders(java.lang.String fileName)
+Parses a CSV file and stores the data line by line, excluding the headers
+ |
+
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic java.util.List<java.util.List<java.lang.String>> readCSVFileByCountry(java.lang.String fileName, + java.lang.String countryName) + throws java.io.IOException+
fileName - String representing the name of a csv file to be readcountryName - String representing the name of a country
+ to parse csv file data forjava.io.IOExceptionpublic java.util.List<java.util.List<java.lang.String>> readCSVFileWithHeaders(java.lang.String fileName) + throws java.io.IOException+
fileName - name of CSV file to parsejava.io.IOExceptionpublic java.util.List<java.util.List<java.lang.String>> readCSVFileWithoutHeaders(java.lang.String fileName) + throws java.io.IOException+
fileName - String representing name of CSV file to parsejava.io.IOExceptionpublic DisasterDescription getMostImpactfulYear(java.util.List<java.util.List<java.lang.String>> records)+
records - list of records to parse throughpublic DisasterDescription getMostImpactfulYearByCategory(java.lang.String category, + java.util.List<java.util.List<java.lang.String>> records)+
category - name of category to find most impactful yearrecords - contains all records of events and yearspublic DisasterDescription getMostImpactfulDisasterByYear(java.lang.String year, + java.util.List<java.util.List<java.lang.String>> records)+
year - records - public DisasterDescription getTotalReportedIncidentsByCategory(java.lang.String category, + java.util.List<java.util.List<java.lang.String>> records)+
public int countImpactfulYearsWithReportedIncidentsWithinRange(java.util.List<java.util.List<java.lang.String>> records, + int min, + int max)+
records - 2D list of recordsmin - integer repretsenting minimum number of incidents for a yearmax - integer representing maximum number of incidnts for a year. Note that
+ this is not rquired, and if no, will be -1.public boolean firstRecordsHaveMoreReportedIndicents(java.util.List<java.util.List<java.lang.String>> records1, + java.util.List<java.util.List<java.lang.String>> records2)+
records1 - 2D list of natural disaster recordsrecords2 - 2D list of natural diaster recordspublic java.util.List<java.lang.String> printDisastersByYear(java.util.List<java.util.List<java.lang.String>> records, + java.lang.String year)+
records - 2D list of recordsyear - year to find disasters forpublic void generateRFile(java.util.List<java.util.List<java.lang.String>> records)+
records - list of recordspublic class CodingCompCSVUtilTest
+extends junit.framework.TestCase
+| Constructor and Description | +
|---|
CodingCompCSVUtilTest() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+setUp() |
+
void |
+testCountImpactfulYearsWithReportedIncidentsWithinRange() |
+
void |
+testFirstRecordsHaveMoreReportedIndicents() |
+
void |
+testGetMostImpactfulDisasterByYear() |
+
void |
+testGetMostImpactfulYear() |
+
void |
+testGetMostImpactfulYearByCategory() |
+
void |
+testGetTheMostImpactfulYearInUSAByEarthquake() |
+
void |
+testGetTotalReportedIncidentsByCategoryy() |
+
void |
+testReadCSVFileWithHeaders() |
+
void |
+testReadCSVFileWithHeadersByCountry() |
+
void |
+testReadCSVFileWithoutHeaders() |
+
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, setName, toStringequals, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic void setUp() + throws java.lang.Exception+
setUp in class junit.framework.TestCasejava.lang.Exceptionpublic void testReadCSVFileWithHeadersByCountry() + throws java.io.IOException+
java.io.IOExceptionpublic void testGetTheMostImpactfulYearInUSAByEarthquake() + throws java.io.IOException+
java.io.IOExceptionpublic void testReadCSVFileWithHeaders() + throws java.io.IOException+
java.io.IOExceptionpublic void testReadCSVFileWithoutHeaders() + throws java.io.IOException+
java.io.IOExceptionpublic void testGetMostImpactfulYear()+
public void testGetMostImpactfulYearByCategory()+
public void testGetMostImpactfulDisasterByYear()+
public void testGetTotalReportedIncidentsByCategoryy()+
public void testCountImpactfulYearsWithReportedIncidentsWithinRange() + throws java.io.IOException+
java.io.IOExceptionpublic void testFirstRecordsHaveMoreReportedIndicents() + throws java.io.IOException+
java.io.IOExceptionpublic class DisasterDescription
+extends java.lang.Object
+| Constructor and Description | +
|---|
DisasterDescription(int amtOfIncidents,
+ java.lang.String category)
+Constructor for DisasterDescription
+ |
+
DisasterDescription(java.lang.String year,
+ int amtOfIncidents)
+Constructor for DisasterDescription
+ |
+
DisasterDescription(java.lang.String year,
+ int amtOfIncidents,
+ java.lang.String category)
+Constructor for DisasterDescription
+ |
+
public DisasterDescription(java.lang.String year, + int amtOfIncidents, + java.lang.String category)+
year - year of a given natural diasteramtOfIncidents - number of incidents for a given natural disastercategory - type of natural disasterpublic DisasterDescription(int amtOfIncidents, + java.lang.String category)+
amtOfIncidents - number of incidents for a given natural disastercategory - type of natural disasterpublic DisasterDescription(java.lang.String year, + int amtOfIncidents)+
year - year of a given natural diasteramtOfIncidents - number of incidents for a given natural disaster| Modifier and Type | +Method and Description | +
|---|---|
DisasterDescription |
+CodingCompCSVUtil.getMostImpactfulDisasterByYear(java.lang.String year,
+ java.util.List<java.util.List<java.lang.String>> records)
+Gets the most impactful disaster based upon a given year
+ |
+
DisasterDescription |
+CodingCompCSVUtil.getMostImpactfulYear(java.util.List<java.util.List<java.lang.String>> records)
+Reads through a given list of records to find the most impactful year in terms
+ of number of incidents, processing it as a DisasterDescription object.
+ |
+
DisasterDescription |
+CodingCompCSVUtil.getMostImpactfulYearByCategory(java.lang.String category,
+ java.util.List<java.util.List<java.lang.String>> records)
+Gets the most impactful year based upon natural disaster category
+ |
+
DisasterDescription |
+CodingCompCSVUtil.getTotalReportedIncidentsByCategory(java.lang.String category,
+ java.util.List<java.util.List<java.lang.String>> records) |
+
| Class | +Description | +
|---|---|
| CodingCompCSVUtil | +
+ Utility class that parses CSV files filled with data about natural disasters, and parses
+ the data accordingly.
+ |
+
| CodingCompCSVUtilTest | ++ |
| DisasterDescription | +
+ Class that serves as a description for natural disasters, describing years,
+ type of natural disaster as well as number of incidents.
+ |
+
| Class and Description | +
|---|
| DisasterDescription
+ Class that serves as a description for natural disasters, describing years,
+ type of natural disaster as well as number of incidents.
+ |
+
Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+Each annotation type has its own separate page with the following sections:
+Each enum has its own separate page with the following sections:
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+These links take you to the next or previous class, interface, package, or related page.
+These links show and hide the HTML frames. All pages are available with or without frames.
+The All Classes link shows all classes and interfaces except non-static nested types.
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+The Constant Field Values page lists the static final fields and their values.
+