BridgeTheGap.java
//taking scanner text and translating it into a vertex, plus adding it to the vertices collection
taking scanner text and translating it into a vertex, plus adding it to the vertices collection
taking scanner text and translating it into a vertex plus adding it to the vertices collection
public ArrayList<Vertex> createAndAddVertex(){
		ArrayList<Vertex> newsOrg = new ArrayList<Vertex>(10);
		File fileName = new File("news.txt");
		try{
			Scanner scan = new Scanner(fileName);
			while (scan.hasNextLine()){
				String line = scan.nextLine();
				if (line.substring(0,3).equals("ï»¿")){
					line = line.substring(3);
					String[] splitStr = line.split(" ");
					String newName = "";
					for (int i = 1; i<splitStr.length-1; i++)
						newName+=splitStr[i] + " ";
					int newRank = Integer.parseInt(splitStr[0]);
					String newUrl = splitStr[splitStr.length-1];
					Vertex newVertex = new Vertex(newName, newRank, newUrl);
					newsOrg.add(newVertex);
					vertexMap.put(newUrl, newVertex); 
				} 
				else {
					String[] splitStr = line.split(" ");
					String newName = "";
					for (int i = 1; i<splitStr.length-1; i++)
						newName+=splitStr[i] + " ";
					int newRank = Integer.parseInt(splitStr[0]);
					String newUrl = splitStr[splitStr.length-1];
					Vertex newVertex = new Vertex(newName, newRank, newUrl);
					newsOrg.add(newVertex);
					vertexMap.put(newUrl, newVertex);
				}
			}
		}
		catch (FileNotFoundException ex){
			System.out.println("Couldn't find file");
		}
		return newsOrg;
	}
public ArrayList < Vertex > createAndAddVertex ( ) { ArrayList < Vertex > newsOrg = new ArrayList < Vertex > ( 10 ) ; File fileName = new File ( "news.txt" ) ; try { Scanner scan = new Scanner ( fileName ) ; while ( scan . hasNextLine ( ) ) { String line = scan . nextLine ( ) ; if ( line . substring ( 0 , 3 ) . equals ( "ï»¿")){ line = line . substring ( 3 ) ; String [ ] splitStr = line . split ( " " ) ; String newName = "" ; for ( int i = 1 ; i < splitStr . length - 1 ; i ++ ) newName += splitStr [ i ] + " " ; int newRank = Integer . parseInt ( splitStr [ 0 ] ) ; String newUrl = splitStr [ splitStr . length - 1 ] ; Vertex newVertex = new Vertex ( newName , newRank , newUrl ) ; newsOrg . add ( newVertex ) ; vertexMap . put ( newUrl , newVertex ) ; } else { String [ ] splitStr = line . split ( " " ) ; String newName = "" ; for ( int i = 1 ; i < splitStr . length - 1 ; i ++ ) newName += splitStr [ i ] + " " ; int newRank = Integer . parseInt ( splitStr [ 0 ] ) ; String newUrl = splitStr [ splitStr . length - 1 ] ; Vertex newVertex = new Vertex ( newName , newRank , newUrl ) ; newsOrg . add ( newVertex ) ; vertexMap . put ( newUrl , newVertex ) ; } } } catch ( FileNotFoundException ex ) { System . out . println ( "Couldn't find file" ) ; } return newsOrg ; }
taking scanner text and translating it into a vertex, plus adding it to the vertices collection
taking scanner text and translating it into a vertex plus adding it to the vertices collection
//read from file!!!