package app;

import java.util.ArrayList;

import models.Person;
import datasources.*;
/**
 * This class implements a Person-Info Service. This service can perform 
 * data-extraction from multiple resources and carry-out simple transformation 
 * operations on the extracted dataset. In addition, this service can filter 
 * persons based on their age group before outputting info to the screen.
 * @author Nash
 */
public class PersonDataService {

	/**
	 * This method is the main loop of this Person-Info Service.
	 * @param nuoriso an optional argument, which could be passed while invoking 
	 * this service. This argument filters the results, who's ages are below 
	 * 18 years (i.e. enlist only Minors).
	 */
	public static void main(String[] args) {
		
		System.out.println("-------------------------------------");
		System.out.println("|   Workshop: Person-Info Service   |");
		System.out.println("-------------------------------------");
		
		final IDataSource csv = new CsvDataProvider("resources/data.csv");
		final IDataSource dummySource = new DummyDataProvider();

		// --- Request data ---
		final ArrayList<Person> persons_Csv = csv.getPersons();
		final ArrayList<Person> persons_Dummy = dummySource.getPersons();

		// --- Print all persons, when no arguments is passed ---
		if (args.length == 0) {
			System.out.println("<< Entire Dataset >>");
			printAll(persons_Csv);
			printAll(persons_Dummy);
		}
		// --- Print all Minors when "nuoriso" is passed as an argument ---
		else if (args[0].equals("nuoriso")) {
			System.out.println("<< Nuoriso >>");
			printMinors(persons_Csv);
			printMinors(persons_Dummy);
		}
		// --- Handle invalid arguments ---
		else {
			System.out.println("Invalid argument!");
			System.out.println("Please input a valid argument, for e.g. 'nuoriso'");
		}
		
	}

	/*
	 * -------------
	 * LOCAL METHODS
	 * -------------
	 */
	private static void printMinors(ArrayList<Person> dataCollection) {
		for (Person person : dataCollection) {
			if (person.getAge() < 18) {
				System.out.println(person);
			}
		}
	}

	private static void printAll(ArrayList<Person> dataCollection) {
		for (Person person : dataCollection) {
			System.out.println(person);
		}
	}	
}

@@ -604,25 +604,34 @@
 is service. 
-T
+On using t
 his argument
@@ -635,86 +635,70 @@
 ent 
-filters the results, who's ages are below %0A%09 * 18 years (i.e. enlist only Mino
+one can list persons who are Minors%0A%09 * (i.e. age below 18 yea
 rs).
@@ -963,16 +963,22 @@
 urce csv
+Source
  = new C
@@ -1101,16 +1101,16 @@
 ata ---%0A
-
 %09%09final 
@@ -1144,16 +1144,22 @@
 sv = csv
+Source
 .getPers

Rename variables & alter Javadocs