import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Iterator;
import javax.swing.JFrame;

import databases.DatabaseLuoghi;
import databases.DatabaseRicerche;
import semantica.AnalizzatoreSemantico;

import maps.Finder;
import maps.GoogleMaps;
import maps.Location;
import javabook.*;

public class Main
{	
	public static void main(String[] argv) throws InterruptedException 
	{
		System.out.println("Starting...");

		/*
		MainWindow main = new MainWindow();
		main.setTitle("Memory Support System");
		main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		main.setVisible(true);
		InputBox input = new InputBox(main);
		input.setTitle("Nuove coordinate");

		//while(true)
		{
			String s1 = input.getString("Inserire una citta:");
			s1.replace(' ', '+');
			String s2 = input.getString("Inserire la via:");
			s2.replace(' ', '+');
			f.newPosition(s2, s2);
		}
		*/

		
		/*Finder f = new Finder();
		f.start();

		new AnalizzatoreSemantico().start();
		
		Thread.sleep(10000);
		f.newPosition("piazza martiri", "savona");
		DatabaseLuoghi dbl = DatabaseLuoghi.getInstance();
		DatabaseRicerche dbr = DatabaseRicerche.getInstance();
		Iterator<String> i = dbr.iterator();
		Thread.sleep(10000);
		System.out.println("Elenco ricerche effettuate:");
		while(i.hasNext())
			dbl.printList(i.next());
		System.out.println("fatto");
		*/
		
		Class x=null;
		try {
			x = Class.forName("java.lang.String");
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

//	  Estrazione di informazioni sul tipo
	Constructor[] c = x.getConstructors();
	Field[] f = x.getDeclaredFields();
	Method[] m = x.getDeclaredMethods();
	Type i[] = x.getGenericInterfaces();
	Type sc = x.getGenericSuperclass();
	String name = x.getName();
	Package p = x.getPackage();

//	 Allocazione di un oggetto appartenente a quel tipo di dato
	Object o=null;
	try {
		o = x.newInstance();
	} 
	catch (InstantiationException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (IllegalAccessException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

//	 Verifica se l'oggetto  un istanza della classe
	boolean ver = x.isInstance(o);
	System.out.println(o.toString());
	}
}
