// Path: src/main/java/ldbc/socialnet/dbgen/util/RandomGeneratorFarm.java
// public class RandomGeneratorFarm {
// 
//     int           numRandomGenerators;
//     Random[]            randomGenerators;
// 
//     public enum Aspect {
//         DATE,
//         BIRTH_DAY,
//         FRIEND_REQUEST,
//         FRIEND_REJECT,
//         FRIEND_APROVAL,
//         INITIATOR,
//         UNIFORM,
//         NUM_INTEREST,
//         NUM_TAG,
//         NUM_FRIEND,
//         NUM_COMMENT,
//         NUM_PHOTO_ALBUM,
//         NUM_PHOTO,
//         NUM_GROUP,
//         NUM_USERS_PER_GROUP,
//         NUM_POPULAR,
//         NUM_LIKE,
//         NUM_POST,
//         FRIEND,
//         FRIEND_LEVEL,
//         GENDER,
//         RANDOM,
//         MEMBERSHIP,
//         MEMBERSHIP_INDEX,
//         GROUP,
//         GROUP_MODERATOR,
//         GROUP_INTEREST,
//         EXTRA_INFO,
//         EXACT_LONG_LAT,
//         STATUS,
//         HAVE_STATUS,
//         STATUS_SINGLE,
//         USER_AGENT,
//         USER_AGENT_SENT,
//         FILE_SELECT,
//         IP,
//         DIFF_IP_FOR_TRAVELER,
//         DIFF_IP,
//         BROWSER,
//         DIFF_BROWSER,
//         CITY,
//         COUNTRY,
//         TAG,
//         UNIVERSITY,
//         UNCORRELATED_UNIVERSITY,
//         UNCORRELATED_UNIVERSITY_LOCATION,
//         TOP_UNIVERSITY,
//         POPULAR,
//         EMAIL,
//         TOP_EMAIL,
//         COMPANY,
//         UNCORRELATED_COMPANY,
//         UNCORRELATED_COMPANY_LOCATION,
//         LANGUAGE,
//         ALBUM,
//         ALBUM_MEMBERSHIP,
//         NAME,
//         SURNAME,
//         TAG_OTHER_COUNTRY,
//         SET_OF_TAG,
//         TEXT_SIZE,
//         REDUCED_TEXT,
//         LARGE_TEXT,
//         MEMBERSHIP_POST_CREATOR,
//         REPLY_TO,
//         TOPIC,
//         NUM_ASPECT                  // This must be always the last one.
//     }
// 
//     public RandomGeneratorFarm () {
//         numRandomGenerators = Aspect.values().length;
//         randomGenerators = new Random[numRandomGenerators];
//         for( int i = 0; i < numRandomGenerators; ++i) {
//             randomGenerators[i] = new Random();
//         }
//     }
// 
//     public Random get(Aspect aspect) {
//         return randomGenerators[aspect.ordinal()];
//     }
// 
//     public void resetRandomGenerators( long seed ) {
//         Random seedRandom = new Random(53223436L + 1234567*seed);
//         for (int i = 0; i < numRandomGenerators; i++) {
//             randomGenerators[i].setSeed(seedRandom.nextLong());
//         }
//     }
// }


import ldbc.socialnet.dbgen.util.RandomGeneratorFarm;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
                    companiesByLocations.get(currentId).add(totalNumCompanies);
                    companyLocation.put(totalNumCompanies, currentId);
                    this.companyName.put(totalNumCompanies, companyName);
                    totalNumCompanies++;
                }
            }
            dictionary.close();
            System.out.println("Done ... " + totalNumCompanies + " companies were extracted");
            
        } catch (IOException e) {
            e.printStackTrace();
        }
	}

	/**
	 * Gets the company country id.
	 */
	public int getCountry(Long company) {
	    return companyLocation.get(company);
	}
	
	/**
	 * Gets a random company of the input country. In case the given country doesn't any company
	 * a random one will be selected.
	 * @param countryId: A country id.
	 */
	public long getRandomCompany(RandomGeneratorFarm randomFarm, int countryId) {
		int locId = countryId;
		Vector<Integer> countries = locationDic.getCountries();
		if (randomFarm.get(RandomGeneratorFarm.Aspect.UNCORRELATED_COMPANY).nextDouble() <= probUnCorrelatedCompany) {
// Path: src/main/java/ldbc/socialnet/dbgen/util/RandomGeneratorFarm.java
// public class RandomGeneratorFarm {
// 
//     int           numRandomGenerators;
//     Random[]            randomGenerators;
// 
//     public enum Aspect {
//         DATE,
//         BIRTH_DAY,
//         FRIEND_REQUEST,
//         FRIEND_REJECT,
//         FRIEND_APROVAL,
//         INITIATOR,
//         UNIFORM,
//         NUM_INTEREST,
//         NUM_TAG,
//         NUM_FRIEND,
//         NUM_COMMENT,
//         NUM_PHOTO_ALBUM,
//         NUM_PHOTO,
//         NUM_GROUP,
//         NUM_USERS_PER_GROUP,
//         NUM_POPULAR,
//         NUM_LIKE,
//         NUM_POST,
//         FRIEND,
//         FRIEND_LEVEL,
//         GENDER,
//         RANDOM,
//         MEMBERSHIP,
//         MEMBERSHIP_INDEX,
//         GROUP,
//         GROUP_MODERATOR,
//         GROUP_INTEREST,
//         EXTRA_INFO,
//         EXACT_LONG_LAT,
//         STATUS,
//         HAVE_STATUS,
//         STATUS_SINGLE,
//         USER_AGENT,
//         USER_AGENT_SENT,
//         FILE_SELECT,
//         IP,
//         DIFF_IP_FOR_TRAVELER,
//         DIFF_IP,
//         BROWSER,
//         DIFF_BROWSER,
//         CITY,
//         COUNTRY,
//         TAG,
//         UNIVERSITY,
//         UNCORRELATED_UNIVERSITY,
//         UNCORRELATED_UNIVERSITY_LOCATION,
//         TOP_UNIVERSITY,
//         POPULAR,
//         EMAIL,
//         TOP_EMAIL,
//         COMPANY,
//         UNCORRELATED_COMPANY,
//         UNCORRELATED_COMPANY_LOCATION,
//         LANGUAGE,
//         ALBUM,
//         ALBUM_MEMBERSHIP,
//         NAME,
//         SURNAME,
//         TAG_OTHER_COUNTRY,
//         SET_OF_TAG,
//         TEXT_SIZE,
//         REDUCED_TEXT,
//         LARGE_TEXT,
//         MEMBERSHIP_POST_CREATOR,
//         REPLY_TO,
//         TOPIC,
//         NUM_ASPECT                  // This must be always the last one.
//     }
// 
//     public RandomGeneratorFarm () {
//         numRandomGenerators = Aspect.values().length;
//         randomGenerators = new Random[numRandomGenerators];
//         for( int i = 0; i < numRandomGenerators; ++i) {
//             randomGenerators[i] = new Random();
//         }
//     }
// 
//     public Random get(Aspect aspect) {
//         return randomGenerators[aspect.ordinal()];
//     }
// 
//     public void resetRandomGenerators( long seed ) {
//         Random seedRandom = new Random(53223436L + 1234567*seed);
//         for (int i = 0; i < numRandomGenerators; i++) {
//             randomGenerators[i].setSeed(seedRandom.nextLong());
//         }
//     }
// }


// Path: src/main/java/ldbc/socialnet/dbgen/dictionary/CompanyDictionary.java
import ldbc.socialnet.dbgen.util.RandomGeneratorFarm;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

                    companiesByLocations.get(currentId).add(totalNumCompanies);
                    companyLocation.put(totalNumCompanies, currentId);
                    this.companyName.put(totalNumCompanies, companyName);
                    totalNumCompanies++;
                }
            }
            dictionary.close();
            System.out.println("Done ... " + totalNumCompanies + " companies were extracted");
            
        } catch (IOException e) {
            e.printStackTrace();
        }
	}

	/**
	 * Gets the company country id.
	 */
	public int getCountry(Long company) {
	    return companyLocation.get(company);
	}
	
	/**
	 * Gets a random company of the input country. In case the given country doesn't any company
	 * a random one will be selected.
	 * @param countryId: A country id.
	 */
	public long getRandomCompany(RandomGeneratorFarm randomFarm, int countryId) {
		int locId = countryId;
		Vector<Integer> countries = locationDic.getCountries();
		if (randomFarm.get(RandomGeneratorFarm.Aspect.UNCORRELATED_COMPANY).nextDouble() <= probUnCorrelatedCompany) {
		    locId = countries.get(randomFarm.get(RandomGeneratorFarm.Aspect.UNCORRELATED_COMPANY_LOCATION).nextInt(countries.size()));