public static void main(String[] args) throws Exception {
		String fileName = "vectors.txt";
		// Global.initializeDataBaseSimulator(fileName);
		ArrayList<DataPoint> points = new ArrayList<DataPoint>();
		ArrayList<Association> left = new ArrayList<Association>();
		ArrayList<Association> associations = new ArrayList<Association>();
		BufferedReader reader = new BufferedReader(new FileReader(fileName));
		String line;
		int i = 1;
		Global.DBSIMULATOR  = new HashMap<String, DataPoint>();
		while ((line = reader.readLine()) != null) {
			System.out.println(i++);
			DataPoint point = new DataPoint(line);
			Cluster seed = new Cluster(point);
			Core.clusterMap.put(seed.getID(),seed);
			Global.DBSIMULATOR.put(point.getID(), point);
			associations = Core.getIncrementalFRange(point, points);
			ArrayList<Association> fClusterAssociations = Core
					.getFRangeClusterAssociation(associations, point);
			points.add(point);
			TreeSet<Association> result = Core.mergeArrays(associations,
					fClusterAssociations, left);
			left = Core.incremantalMergeCluster(result);
			left = Core.refineStepOne(left);
			Core.refineClusters();
		}
		int counter=0;
		for (String clusterId : clusterMap.keySet()) {
			Cluster current = Core.clusterMap.get(clusterId);
			System.out.println(current.getDataPointSet().size());
			if(current.getDataPointSet().size()>1)
				counter+=current.getDataPointSet().size();
			for (String s : current.getDataPointSet()) {
//				DataPoint sPoint = Global.DBSIMULATOR.get(s);
//				System.out.println(sPoint.getID()+" || "+sPoint.getMin());
//				for(String t : current.getDataPointSet())
//				{
//					if(!s.equals(t))
//					{
//						DataPoint tPoint = Global.DBSIMULATOR.get(t);
//						System.out.println(sPoint.getID()+" || "+tPoint.getID()+" || "+sPoint.calculateDistance(tPoint));
//					}
//				}
				System.out.println(Global.DBSIMULATOR.get(s).getUrl());
			}
			System.out.println("------------------------");
		}
		System.out.println(counter);
		//
		// ArrayList<Cluster> clusters = new ArrayList<Cluster>();
		// for (String clusterId : clusterMap.keySet()){
		// clusters.add(Core.clusterMap.get(clusterId));
		// }
		// Collections.sort(clusters,new Comparator<Cluster>() {
		//
		// @Override
		// public int compare(Cluster o1, Cluster o2) {
		// // TODO Auto-generated method stub
		// return (o1.getSize()-o2.getSize());
		// }
		// });
		// ArrayList<String> temp = new ArrayList<String>();
		//
		// for(Cluster c : clusters)
		// temp.add(c.getID()+" || "+c.getSize());
		// Collections.sort(temp);
		// for(String s : temp)
		// System.out.println(s);

		// HashMap<Integer, String> patternsMap =
		// Core.loadDataFromFile(fileName);
		//
		// Display display = new Display();
		// JFreeChart chart1 = SWTBarChartDemo.createChart(clusters,
		// patternsMap,
		// 8000);
		// Shell shell1 = new Shell(display);
		// shell1.setSize(1000, 800);
		// shell1.setLayout(new FillLayout());
		// shell1.setText("Draw Mitosis Clusters");
		// ChartComposite frame1 = new ChartComposite(shell1, SWT.NONE, chart1,
		// true);
		//
		// frame1.pack();
		// shell1.open();
		// while (!shell1.isDisposed()) {
		// if (!display.readAndDispatch())
		// display.sleep();
		// }

	}