public HubLinkMapping(String fileName,int numberOfHubs,Network network){
  this.numberOfHubs=numberOfHubs;
  if (fileName.contains(".mappingTable.")) {
    readMappingTable(fileName);
    unMappedLinksAtZeroHub=true;
    return;
  }
  handleUnmappedLinksStart();
  try {
    FileReader fr=new FileReader(fileName);
    BufferedReader br=new BufferedReader(fr);
    String line;
    StringTokenizer tokenizer;
    String token;
    int linkId;
    line=br.readLine();
    while (line != null) {
      tokenizer=new StringTokenizer(line);
      for (int i=0; i < this.numberOfHubs; i++) {
        token=tokenizer.nextToken();
        linkId=(int)Double.parseDouble(token);
        linkHubMapping.put(Integer.toString(linkId),i);
      }
      if (tokenizer.hasMoreTokens()) {
        throw new RuntimeException("the number of hubs is wrong");
      }
      line=br.readLine();
    }
  }
 catch (  RuntimeException e) {
    throw e;
  }
catch (  Exception e) {
    throw new RuntimeException("Error reading the hub link mapping file");
  }
  linkHubMapping.remove("-1");
  handleUnmappedLinksEnd(network);
}

public HubLinkMapping ( String fileName , int numberOfHubs , Network network ) { this . numberOfHubs = numberOfHubs ; if ( fileName . contains ( ".mappingTable." ) ) { readMappingTable ( fileName ) ; unMappedLinksAtZeroHub = true ; return ; } handleUnmappedLinksStart ( ) ; try { FileReader fr = new FileReader ( fileName ) ; BufferedReader br = new BufferedReader ( fr ) ; String line ; StringTokenizer tokenizer ; String token ; int linkId ; line = br . readLine ( ) ; while ( line != null ) { tokenizer = new StringTokenizer ( line ) ; for ( int i = 0 ; i < this . numberOfHubs ; i ++ ) { token = tokenizer . nextToken ( ) ; linkId = ( int ) Double . parseDouble ( token ) ; linkHubMapping . put ( Integer . toString ( linkId ) , i ) ; } if ( tokenizer . hasMoreTokens ( ) ) { throw new RuntimeException ( "the number of hubs is wrong" ) ; } line = br . readLine ( ) ; } } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw new RuntimeException ( "Error reading the hub link mapping file" ) ; } linkHubMapping . remove ( "-1" ) ; handleUnmappedLinksEnd ( network ) ; }
reads the mappings from the file . the file has columns ( first column for first hub and all the links corresponding to that hub below it )
