Examples/AirlineFaresNew/src/main/java/com/cs6240/airline/FileEvaluator.java
/*
	 * Method does follwing tasks
	 * 		1. Reads CSV file and validates it.
	 * 		2. Sets the K and F counts for sane/insane flights
	 * 		3. Creates Map with list of prices for carriers 
	 */
Method does follwing tasks
1. Reads CSV file and validates it.
2. Sets the K and F counts for sane/insane flights
3. Creates Map with list of prices for carriers
Method does follwing tasks 1 . Reads CSV file and validates it . 2 . Sets the K and F counts for sane / insane flights 3 . Creates Map with list of prices for carriers
private void readCSVAndCreatePriceMapForSaneFlights() {
		BufferedReader reader = null;
		CSVParser parser = null;
		try {
			FileInputStream fin = new FileInputStream(file);
			GZIPInputStream gzis = new GZIPInputStream(fin);
			InputStreamReader xover = new InputStreamReader(gzis);
			reader = new BufferedReader(xover);
			parser = new CSVParser(reader, CSVFormat.EXCEL.withHeader());
			for (final CSVRecord record : parser) {
				if(record.size() == 110) {
					try {
						AirlineDetailsPojo airline = new AirlineDetailsPojo(record);
						AirlineSanity.sanityCheck(airline);
						createMapWithFlightDetails(airline);
						if(airline.getYear() == 2015) {
							flightsActiveIn2015.add(airline.getCarrier());
						}
						f++;
					}catch (InsaneInputException e) {
						k++; 
					}catch (InvalidFormatException e) {
						k++; 
					}
				} else {
					k++;
				}
			}
			k++; 
		} catch(FileNotFoundException e){
			System.err.println("File not Found Exception occured");
		} catch (IOException e1) {
			System.err.println("IO Exception occured");
		} finally {
			try {
				parser.close();
				reader.close();
			} catch (IOException e) {
				System.err.println("IOException occured");
			}
		}
	}
private void readCSVAndCreatePriceMapForSaneFlights ( ) { BufferedReader reader = null ; CSVParser parser = null ; try { FileInputStream fin = new FileInputStream ( file ) ; GZIPInputStream gzis = new GZIPInputStream ( fin ) ; InputStreamReader xover = new InputStreamReader ( gzis ) ; reader = new BufferedReader ( xover ) ; parser = new CSVParser ( reader , CSVFormat . EXCEL . withHeader ( ) ) ; for ( final CSVRecord record : parser ) { if ( record . size ( ) == 110 ) { try { AirlineDetailsPojo airline = new AirlineDetailsPojo ( record ) ; AirlineSanity . sanityCheck ( airline ) ; createMapWithFlightDetails ( airline ) ; if ( airline . getYear ( ) == 2015 ) { flightsActiveIn2015 . add ( airline . getCarrier ( ) ) ; } f ++ ; } catch ( InsaneInputException e ) { k ++ ; } catch ( InvalidFormatException e ) { k ++ ; } } else { k ++ ; } } k ++ ; } catch ( FileNotFoundException e ) { System . err . println ( "File not Found Exception occured" ) ; } catch ( IOException e1 ) { System . err . println ( "IO Exception occured" ) ; } finally { try { parser . close ( ) ; reader . close ( ) ; } catch ( IOException e ) { System . err . println ( "IOException occured" ) ; } } }
Method does follwing tasks
              1.
Method does follwing tasks 1 .
// input is failing saity test //input is not valid // no of columns is not matching the headers  //As header is not a valid line