gt: 			for (int i = 0; i < backlinkIds.length; i++) {
context: package focusedCrawler.link;
  
  import java.io.IOException;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.util.HashSet;
  import java.util.Iterator;
  import java.util.StringTokenizer;
  import java.util.Vector;
  
  import focusedCrawler.link.LinkStorageConfig.BiparitieGraphRepConfig;
  import focusedCrawler.util.ParameterFile;
  import focusedCrawler.util.parser.BackLinkNeighborhood;
  import focusedCrawler.util.parser.LinkNeighborhood;
  import focusedCrawler.util.persistence.PersistentHashtable;
  import focusedCrawler.util.persistence.Tuple;
  
  public class BipartiteGraphRep {
  
  //	private PersistentHashtable hubs;
  	
  //	private PersistentHashtable auths;
  	
  	private PersistentHashtable authGraph; 
  	
  	private PersistentHashtable authID;
  
  	private PersistentHashtable hubGraph; 
  	
  	private PersistentHashtable hubID;
  	
  	private PersistentHashtable url2id;
  
  	
  	private final String separator = "###";
  	
  	
  
  	public BipartiteGraphRep(String dataPath, BiparitieGraphRepConfig config) {
  	    int cacheSize = 100000;
  	    this.authGraph = new PersistentHashtable(dataPath + "/" + config.getAuthGraphDirectory(), cacheSize);
          this.url2id = new PersistentHashtable(dataPath + "/" + config.getUrlIdDirectory(), cacheSize);
          this.authID = new PersistentHashtable(dataPath + "/" + config.getAuthIdDirectory(), cacheSize);
          this.hubID = new PersistentHashtable(dataPath + "/" + config.getHubIdDirectory(), cacheSize);
          this.hubGraph = new PersistentHashtable(dataPath + "/" + config.getHubGraphDirectory(), cacheSize);
  	}
  	
  	public Tuple[] getAuthGraph() throws Exception{
  		return authGraph.getTable();
  	}
  
  	public Tuple[] getHubGraph() throws Exception{
  		return hubGraph.getTable();
  	}
  	
  	public String getID(String url){
  		return url2id.get(url);
  	}
  	
  	public HashSet<String> getAuthURLs() throws Exception{
  		HashSet<String> result = new HashSet<String>();
  		for (Iterator<String> iter = authID.getKeys(); iter.hasNext();) {
  			String id = (String) iter.next();
  			String url = getAuthURL(id);
  			if(url != null){
  				result.add(url);
  			}
  		}
  		return result;
  	}
  
  	public String getHubURL(String id) throws IOException{
  		String url = hubID.get(id);
  		if(url != null){
  			String[] fields = url.split(":::");
  			url = fields[0];
  		}
  		return url;
  	}
  	
  	public String getAuthURL(String id){
  		String url = authID.get(id);
  		if(url != null){
  			String[] fields = url.split(":::");
  			url = fields[0];
  		}
  		return url;
  	}
  
  	public String[] getOutlinks(String id){
  		String links = hubGraph.get(id);
  		if(links != null){
  			return links.split("###");	
  		}else{
  			return null;
  		}
  	}
  
  	public String[] getBacklinks(String id){
  		String links = authGraph.get(id);
  		if(links != null){
  			return links.split("###");	
  		}else{
  			return null;
  		}
  
  	}
  	
  	public LinkNeighborhood[] getLNs() throws Exception{
  		Tuple[] tuples = authID.getTable();
  		LinkNeighborhood[] lns = new LinkNeighborhood[tuples.length];
  		for (int i = 0; i < lns.length; i++) {
  			String strln = tuples[i].getValue();
  			if(strln != null){
  				String[] fields = strln.split(":::");
  				lns[i] = new LinkNeighborhood(new URL(fields[0]));
  				if(fields.length > 1){
  					lns[i].setAnchor(fields[1].split(" "));
  					if(fields.length > 2){
  						lns[i].setAround(fields[2].split(" "));
  					}
  				}
  			}
  		}
  		return lns;
  	}
  
  	public LinkNeighborhood[] getBacklinkLN() throws Exception{
  		Tuple[] tuples = hubID.getTable();
  		LinkNeighborhood[] lns = new LinkNeighborhood[tuples.length];
  		for (int i = 0; i < lns.length; i++) {
  			String strln = tuples[i].getValue();
  			if(strln != null){
  				String[] fields = strln.split(":::");
  				lns[i] = new LinkNeighborhood(new URL(fields[0]));
  				if(fields.length > 1){
  					String title = fields[1];
  					if(title != null){
  						StringTokenizer tokenizer = new StringTokenizer(title," ");
  						Vector<String> anchorTemp = new Vector<String>();
  						while(tokenizer.hasMoreTokens()){
  							 anchorTemp.add(tokenizer.nextToken());
  			   		  	}
  			   		  	String[] aroundArray = new String[anchorTemp.size()];
  			   		  	anchorTemp.toArray(aroundArray);
  			   		  	lns[i].setAround(aroundArray);
  					}
  				}
  			}
  		}
  		return lns;
  	}
  
  	
  	public LinkNeighborhood getBacklinkLN(URL url) throws MalformedURLException{
  		LinkNeighborhood ln = null;
  		String urlId = url2id.get(url.toString());
  		if(urlId != null){
  			String strln = hubID.get(urlId);
  			if(strln != null){
  				String[] fields = strln.split(":::");
  				ln = new LinkNeighborhood(new URL(fields[0]));
  				if(fields.length > 1){
  					String title = fields[1];
  					if(title != null){
  						StringTokenizer tokenizer = new StringTokenizer(title," ");
  						Vector<String> anchorTemp = new Vector<String>();
  						while(tokenizer.hasMoreTokens()){
  							 anchorTemp.add(tokenizer.nextToken());
  			   		  	}
  			   		  	String[] aroundArray = new String[anchorTemp.size()];
  			   		  	anchorTemp.toArray(aroundArray);
  			   		  	ln.setAround(aroundArray);
  					}
  				}
  			}
  		}
  		return ln;
  	}
  
  	
  	public LinkNeighborhood getLN(URL url) throws MalformedURLException{
  		LinkNeighborhood ln = null;
  		URL normalizedURL = url;//new URL(url.getProtocol(), url.getHost(), "/"); 
  		String urlId = url2id.get(normalizedURL.toString());
  		if(urlId != null){
  			String strln = authID.get(urlId);
  			ln = parseString(strln);
  		}
  		return ln;
  	}
  	
  	
  	public LinkNeighborhood[] getOutlinks(URL url) throws IOException{
  		String urlId = url2id.get(url.toString());
  //		System.out.println("**OUTLINKS**");
  //		System.out.println("**" + strLinks + "**");
  		if(urlId == null){
  			return null;
  		}else{
  			String[] linkIds = hubGraph.get(urlId).split("###");
  			LinkNeighborhood[] lns = new LinkNeighborhood[linkIds.length];
  			for (int i = 0; i < lns.length; i++) {
  				String strln = authID.get(linkIds[i]);
  				if(strln != null){
  					String[] fields = strln.split(":::");
  					LinkNeighborhood ln = new LinkNeighborhood(new URL(fields[0]));
  					lns[i] = ln;
  					if(fields.length > 1){
  						ln.setAnchor(fields[1].split(" "));
  						if(fields.length > 2){
  							ln.setAround(fields[2].split(" "));	
  						}
  					}
  						
  				}
  			}
  			return lns;
  		}
  	}
  	
  	/**
  	 * This method retrieves the the backlinks of a given url.
  	 * @param url
  	 * @return
  	 * @throws IOException
  	 */
  
  	public BackLinkNeighborhood[] getBacklinks(URL url) throws IOException {
  //		System.out.println(url.getHost());
  //		String strLinks = auths.get(url.getHost());
  		URL normalizedURL = new URL(url.getProtocol(), url.getHost(), "/"); 
  		String urlId = url2id.get(normalizedURL.toString());
  		if(urlId == null){
  			return null;
  		}
  //		System.out.println("**BACKLINKS**"+urlId);
  		String strLinks = authGraph.get(urlId);
  //		System.out.println("**" + strLinks + "**");
  		if(strLinks == null){
  			return null;
  		}else{
  			Vector<BackLinkNeighborhood> tempBacklinks = new Vector<BackLinkNeighborhood> (); 
  			String[] backlinkIds = strLinks.split("###");
  