Example usage for java.lang Integer Integer

List of usage examples for java.lang Integer Integer

Introduction

In this page you can find the example usage for java.lang Integer Integer.

Prototype

@Deprecated(since = "9")
public Integer(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Integer object that represents the int value indicated by the String parameter.

Usage

From source file:uk.ac.gda.dls.client.views.EnumPositionerCompositeFactory.java

public static void main(String... args) {

    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new BorderLayout());

    DummyPositioner dummy = new DummyPositioner();
    dummy.setName("dummy");
    try {// www. j ava2  s.  c o m
        dummy.configure();
    } catch (FactoryException e1) {
        // TODO Auto-generated catch block
    }

    dummy.setPositions(new String[] { "position1", "position2", "position3" });
    try {
        dummy.moveTo(1);
    } catch (DeviceException e) {
        System.out.println("Can not move dummy to position 1");
    }

    final EnumPositionerComposite comp = new EnumPositionerComposite(shell, SWT.NONE, dummy, "",
            new Integer(100), new Integer(200));
    comp.setLayoutData(BorderLayout.NORTH);
    comp.setVisible(true);
    shell.pack();
    shell.setSize(400, 400);
    SWTUtils.showCenteredShell(shell);
}

From source file:uk.ac.gda.dls.client.views.ReadonlyScannableCompositeFactory.java

public static void main(String... args) {

    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new BorderLayout());

    DummyMonitor dummy = new DummyMonitor();
    dummy.setName("dummy");
    dummy.configure();//from   w  w  w.  j  a  va  2 s .  c  om
    final ReadonlyScannableComposite comp = new ReadonlyScannableComposite(shell, SWT.NONE, dummy, "", "units",
            new Integer(2));
    comp.setLayoutData(BorderLayout.NORTH);
    comp.setVisible(true);
    shell.pack();
    shell.setSize(400, 400);
    SWTUtils.showCenteredShell(shell);
}

From source file:com.ingby.socbox.bischeck.test.JDBCtest.java

static public void main(String[] args)
        throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {

    CommandLineParser parser = new GnuParser();
    CommandLine line = null;/* w ww. j  a va2s.  c om*/

    // create the Options
    Options options = new Options();
    options.addOption("u", "usage", false, "show usage.");
    options.addOption("c", "connection", true, "the connection url");
    options.addOption("s", "sql", true, "the sql statement to run");
    options.addOption("m", "meta", true, "get the table meta data");
    options.addOption("C", "columns", true, "the number of columns to display, default 1");
    options.addOption("d", "driver", true, "the driver class");
    options.addOption("v", "verbose", false, "verbose outbout");

    try {
        // parse the command line arguments
        line = parser.parse(options, args);
    } catch (org.apache.commons.cli.ParseException e) {
        System.out.println("Command parse error:" + e.getMessage());
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("JDBCtest", options);
        Util.ShellExit(1);
    }

    if (line.hasOption("verbose")) {
        verbose = true;
    }

    if (line.hasOption("usage")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("Bischeck", options);
        Util.ShellExit(0);
    }

    String driverclassname = null;
    if (!line.hasOption("driver")) {
        System.out.println("Driver class must be set");
        Util.ShellExit(1);
    } else {
        driverclassname = line.getOptionValue("driver");
        outputln("DriverClass: " + driverclassname);
    }

    String connectionname = null;
    if (!line.hasOption("connection")) {
        System.out.println("Connection url must be set");
        Util.ShellExit(1);
    } else {
        connectionname = line.getOptionValue("connection");
        outputln("Connection: " + connectionname);
    }

    String sql = null;
    String tablename = null;

    if (line.hasOption("sql")) {
        sql = line.getOptionValue("sql");
        outputln("SQL: " + sql);

    }

    if (line.hasOption("meta")) {
        tablename = line.getOptionValue("meta");
        outputln("Table: " + tablename);
    }

    int nrColumns = 1;
    if (line.hasOption("columns")) {
        nrColumns = new Integer(line.getOptionValue("columns"));
    }

    long execStart = 0l;
    long execEnd = 0l;
    long openStart = 0l;
    long openEnd = 0l;
    long metaStart = 0l;
    long metaEnd = 0l;

    Class.forName(driverclassname).newInstance();
    openStart = System.currentTimeMillis();
    Connection conn = DriverManager.getConnection(connectionname);
    openEnd = System.currentTimeMillis();

    if (tablename != null) {
        ResultSet rsCol = null;
        metaStart = System.currentTimeMillis();
        DatabaseMetaData md = conn.getMetaData();
        metaEnd = System.currentTimeMillis();

        rsCol = md.getColumns(null, null, tablename, null);
        if (verbose) {
            tabular("COLUMN_NAME");
            tabular("TYPE_NAME");
            tabular("COLUMN_SIZE");
            tabularlast("DATA_TYPE");
            outputln("");
        }

        while (rsCol.next()) {
            tabular(rsCol.getString("COLUMN_NAME"));
            tabular(rsCol.getString("TYPE_NAME"));
            tabular(rsCol.getString("COLUMN_SIZE"));
            tabularlast(rsCol.getString("DATA_TYPE"));
            outputln("", true);
        }
    }

    if (sql != null) {
        Statement stat = conn.createStatement();
        stat.setQueryTimeout(10);

        execStart = System.currentTimeMillis();
        ResultSet res = stat.executeQuery(sql);
        ResultSetMetaData rsmd = res.getMetaData();
        execEnd = System.currentTimeMillis();

        if (verbose) {
            for (int i = 1; i < nrColumns + 1; i++) {
                if (i != nrColumns)
                    tabular(rsmd.getColumnName(i));
                else
                    tabularlast(rsmd.getColumnName(i));
            }
            outputln("");
        }
        while (res.next()) {
            for (int i = 1; i < nrColumns + 1; i++) {
                if (i != nrColumns)
                    tabular(res.getString(i));
                else
                    tabularlast(res.getString(i));
            }
            outputln("", true);
        }

        stat.close();
        res.close();
    }

    conn.close();

    // Print the execution times
    outputln("Open time: " + (openEnd - openStart) + " ms");

    if (line.hasOption("meta")) {
        outputln("Meta time: " + (metaEnd - metaStart) + " ms");
    }

    if (line.hasOption("sql")) {
        outputln("Exec time: " + (execEnd - execStart) + " ms");
    }
}

From source file:fdtutilscli.Main.java

/**
 * //from  w  ww  .j av  a  2 s .c  o  m
 * @param args the command line arguments
 */
public static void main(String[] args) {

    CommandLineParser parser = new PosixParser();
    CommandLine line = null;
    Options options = new Options();
    OptionGroup optCommand = new OptionGroup();
    OptionGroup optOutput = new OptionGroup();
    HelpFormatter formatter = new HelpFormatter();
    TRACE trace = TRACE.DEFAULT;

    optCommand.addOption(OptionBuilder.withArgName("ndf odf nif key seperator").hasArgs(5)
            .withValueSeparator(' ').withDescription("Description").create("delta"));
    optCommand.addOption(OptionBuilder.withArgName("dupsfile key seperator").hasArgs(3)
            .withDescription("Description").create("duplicates"));
    optCommand.addOption(OptionBuilder.withLongOpt("help").withDescription("print this message.").create("h"));
    optCommand.addOption(
            OptionBuilder.withLongOpt("version").withDescription("print version information.").create("V"));
    optOutput.addOption(new Option("verbose", "be extra verbose"));
    optOutput.addOption(new Option("quiet", "be extra quiet"));
    optOutput.addOption(new Option("silent", "same as --quiet"));
    options.addOptionGroup(optCommand);
    options.addOptionGroup(optOutput);

    try {
        line = parser.parse(options, args);

        if (line.hasOption("verbose")) {
            trace = TRACE.VERBOSE;
        } else if (line.hasOption("quiet") || line.hasOption("silent")) {
            trace = TRACE.QUIET;
        }

        if (line.hasOption("h")) {
            formatter.printHelp(HELP_SYNTAX, HELP_HEADER, options, null, true);
            return;
        } else if (line.hasOption("V")) {
            System.out.println(APP_NAME + " version " + VERSION);
            System.out.println("fDTDeltaBuilder version " + DTDeltaBuilder.version());
            System.out.println("DTDuplicateKeyFinder version " + DTDuplicateKeyFinder.version());
            return;
        } else if (line.hasOption("delta")) {
            String ndf = line.getOptionValues("delta")[0];
            String odf = line.getOptionValues("delta")[1];
            String nif = line.getOptionValues("delta")[2];
            Integer key = (line.getOptionValues("delta").length <= 3) ? DEFAULT_KEY
                    : new Integer(line.getOptionValues("delta")[3]);
            String seperator = (line.getOptionValues("delta").length <= 4) ? DEFAULT_SEPERATOR
                    : line.getOptionValues("delta")[4];

            doDelta(ndf, odf, nif, key.intValue(), seperator, trace);

            return;
        } else if (line.hasOption("duplicates")) {
            String dupsFile = line.getOptionValues("duplicates")[0];
            Integer key = (line.getOptionValues("duplicates").length <= 1) ? DEFAULT_KEY
                    : new Integer(line.getOptionValues("duplicates")[1]);
            String seperator = (line.getOptionValues("duplicates").length <= 2) ? DEFAULT_SEPERATOR
                    : line.getOptionValues("duplicates")[2];
            doDuplicates(dupsFile, key.intValue(), seperator, trace);
            return;
        } else if (args.length == 0) {
            formatter.printHelp(HELP_SYNTAX, HELP_HEADER, options, null, true);
        } else {
            throw new UnrecognizedOptionException(E_MSG_UNREC_OPT);
        }

    } catch (UnrecognizedOptionException e) {
        formatter.printHelp(HELP_SYNTAX, HELP_HEADER, options, HELP_FOOTER + e.getMessage(), true);
    } catch (ParseException e) {
        formatter.printHelp(HELP_SYNTAX, HELP_HEADER, options, HELP_FOOTER + e.getMessage(), true);
    }
}

From source file:SequentialPageRank.java

@SuppressWarnings({ "static-access" })
public static void main(String[] args) throws IOException {
    Options options = new Options();

    options.addOption(OptionBuilder.withArgName("path").hasArg().withDescription("input path").create(INPUT));
    options.addOption(//from w  w w  . j a  v a 2  s .c  o m
            OptionBuilder.withArgName("val").hasArg().withDescription("random jump factor").create(JUMP));

    CommandLine cmdline = null;
    CommandLineParser parser = new GnuParser();

    try {
        cmdline = parser.parse(options, args);
    } catch (ParseException exp) {
        System.err.println("Error parsing command line: " + exp.getMessage());
        System.exit(-1);
    }

    if (!cmdline.hasOption(INPUT)) {
        System.out.println("args: " + Arrays.toString(args));
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(120);
        formatter.printHelp(SequentialPageRank.class.getName(), options);
        ToolRunner.printGenericCommandUsage(System.out);
        System.exit(-1);
    }

    String infile = cmdline.getOptionValue(INPUT);
    float alpha = cmdline.hasOption(JUMP) ? Float.parseFloat(cmdline.getOptionValue(JUMP)) : 0.15f;

    int edgeCnt = 0;
    DirectedSparseGraph<String, Integer> graph = new DirectedSparseGraph<String, Integer>();

    BufferedReader data = new BufferedReader(new InputStreamReader(new FileInputStream(infile)));

    String line;
    while ((line = data.readLine()) != null) {
        line.trim();
        String[] arr = line.split("\\t");

        for (int i = 1; i < arr.length; i++) {
            graph.addEdge(new Integer(edgeCnt++), arr[0], arr[i]);
        }
    }

    data.close();

    WeakComponentClusterer<String, Integer> clusterer = new WeakComponentClusterer<String, Integer>();

    Set<Set<String>> components = clusterer.transform(graph);
    int numComponents = components.size();
    System.out.println("Number of components: " + numComponents);
    System.out.println("Number of edges: " + graph.getEdgeCount());
    System.out.println("Number of nodes: " + graph.getVertexCount());
    System.out.println("Random jump factor: " + alpha);

    // Compute PageRank.
    PageRank<String, Integer> ranker = new PageRank<String, Integer>(graph, alpha);
    ranker.evaluate();

    // Use priority queue to sort vertices by PageRank values.
    PriorityQueue<Ranking<String>> q = new PriorityQueue<Ranking<String>>();
    int i = 0;
    for (String pmid : graph.getVertices()) {
        q.add(new Ranking<String>(i++, ranker.getVertexScore(pmid), pmid));
    }

    // Print PageRank values.
    System.out.println("\nPageRank of nodes, in descending order:");
    Ranking<String> r = null;
    while ((r = q.poll()) != null) {
        System.out.println(r.rankScore + "\t" + r.getRanked());
    }
}

From source file:uk.ac.gda.dls.client.views.LinearPositionerCompositeFactory.java

public static void main(String... args) {

    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new BorderLayout());

    DummyScannable dummy = new DummyScannable();
    dummy.setName("dummy");
    try {/*from ww  w  .  j a  v a  2  s.c  o  m*/
        dummy.configure();
    } catch (FactoryException e1) {
        // TODO Auto-generated catch block
    }

    try {
        dummy.moveTo(33);
        //         dummy.moveTo(1);
    } catch (DeviceException e) {
        System.out.println("Can not move dummy to position 1");
    }

    final LinearPositionerComposite comp = new LinearPositionerComposite(shell, SWT.NONE, dummy, "",
            new Integer(100), new Integer(200), new Integer(0), new Integer(60));
    comp.setLayoutData(BorderLayout.NORTH);
    comp.setVisible(true);
    shell.pack();
    shell.setSize(400, 400);
    SWTUtils.showCenteredShell(shell);
}

From source file:uk.ac.gda.dls.client.views.ScannableCompositeFactory.java

public static void main(String... args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new BorderLayout());
    DummyScannable dummy = new DummyScannable();
    dummy.setName("dummy");
    try {/*  ww  w.  ja  va 2  s  .  c  o  m*/
        dummy.configure();
    } catch (FactoryException e) {
        // TODO Auto-generated catch block
    }
    ScannableComposite comp = new ScannableComposite(shell, SWT.NONE, dummy, "", "units", new Integer(2),
            new Integer(100), new Integer(200));
    comp.setLayoutData(BorderLayout.NORTH);
    comp.setVisible(true);
    shell.pack();
    shell.setSize(400, 400);
    SWTUtils.showCenteredShell(shell);
}

From source file:de.dominicscheurer.passwords.Main.java

/**
 * @param args//www .  j  a v  a2  s.  co m
 *            Command line arguments (see code or output of program when
 *            started with no arguments).
 */
@SuppressWarnings("static-access")
public static void main(String[] args) {
    Options options = new Options();

    Option seedPwdOpt = OptionBuilder.withArgName("Seed Password").isRequired().hasArg()
            .withDescription("Password used as a seed").withLongOpt("seed-password").create("s");

    Option serviceIdOpt = OptionBuilder.withArgName("Service Identifier").isRequired().hasArg()
            .withDescription("The service that the password is created for, e.g. facebook.com")
            .withLongOpt("service-identifier").create("i");

    Option pwdLengthOpt = OptionBuilder.withArgName("Password Length").withType(Integer.class).hasArg()
            .withDescription("Length of the password in characters").withLongOpt("pwd-length").create("l");

    Option specialChars = OptionBuilder.withArgName("With special chars (TRUE|false)").withType(Boolean.class)
            .hasArg().withDescription("Set to true if special chars !-_?=@/+* are desired, else false")
            .withLongOpt("special-chars").create("c");

    Option suppressPwdOutpOpt = OptionBuilder
            .withDescription("Suppress password output (copy to clipboard only)").withLongOpt("hide-password")
            .hasArg(false).create("x");

    Option helpOpt = OptionBuilder.withDescription("Prints this help message").withLongOpt("help").create("h");

    options.addOption(seedPwdOpt);
    options.addOption(serviceIdOpt);
    options.addOption(pwdLengthOpt);
    options.addOption(specialChars);
    options.addOption(suppressPwdOutpOpt);
    options.addOption(helpOpt);

    CommandLineParser parser = new GnuParser();
    try {
        CommandLine cmd = parser.parse(options, args);

        if (cmd.hasOption("h")) {
            SafePwdGen.printHelp(options);
            System.exit(0);
        }

        int pwdLength = STD_PWD_LENGTH;
        if (cmd.hasOption("l")) {
            pwdLength = new Integer(cmd.getOptionValue("l"));
        }

        boolean useSpecialChars = true;
        if (cmd.hasOption("c")) {
            useSpecialChars = new Boolean(cmd.getOptionValue("c"));
        }

        if (pwdLength > MAX_PWD_LENGTH_64 && !useSpecialChars) {
            System.out.println(PASSWORD_SIZE_TOO_BIG + MAX_PWD_LENGTH_64);
        }

        if (pwdLength > MAX_PWD_LENGTH_71 && useSpecialChars) {
            System.out.println(PASSWORD_SIZE_TOO_BIG + MAX_PWD_LENGTH_71);
        }

        boolean suppressPwdOutput = cmd.hasOption('x');

        String pwd = SafePwdGen.createPwd(cmd.getOptionValue("s"), cmd.getOptionValue("i"), pwdLength,
                useSpecialChars);

        if (!suppressPwdOutput) {
            System.out.print(GENERATED_PASSWORD);
            System.out.println(pwd);
        }
        System.out.println(CLIPBOARD_COPIED_MSG);
        SystemClipboardInterface.copy(pwd);

        System.in.read();
    } catch (ParseException e) {
        System.out.println(e.getLocalizedMessage());
        SafePwdGen.printHelp(options);
    } catch (UnsupportedEncodingException e) {
        System.out.println(e.getLocalizedMessage());
    } catch (NoSuchAlgorithmException e) {
        System.out.println(e.getLocalizedMessage());
    } catch (IOException e) {
        System.out.println(e.getLocalizedMessage());
    }
}

From source file:SequentialPersonalizedPageRank.java

@SuppressWarnings({ "static-access" })
public static void main(String[] args) throws IOException {
    Options options = new Options();

    options.addOption(OptionBuilder.withArgName("path").hasArg().withDescription("input path").create(INPUT));
    options.addOption(// w  w w .  ja  v a 2s .co  m
            OptionBuilder.withArgName("val").hasArg().withDescription("random jump factor").create(JUMP));
    options.addOption(OptionBuilder.withArgName("node").hasArg()
            .withDescription("source node (i.e., destination of the random jump)").create(SOURCE));

    CommandLine cmdline = null;
    CommandLineParser parser = new GnuParser();

    try {
        cmdline = parser.parse(options, args);
    } catch (ParseException exp) {
        System.err.println("Error parsing command line: " + exp.getMessage());
        System.exit(-1);
    }

    if (!cmdline.hasOption(INPUT) || !cmdline.hasOption(SOURCE)) {
        System.out.println("args: " + Arrays.toString(args));
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(120);
        formatter.printHelp(SequentialPersonalizedPageRank.class.getName(), options);
        ToolRunner.printGenericCommandUsage(System.out);
        System.exit(-1);
    }

    String infile = cmdline.getOptionValue(INPUT);
    final String source = cmdline.getOptionValue(SOURCE);
    float alpha = cmdline.hasOption(JUMP) ? Float.parseFloat(cmdline.getOptionValue(JUMP)) : 0.15f;

    int edgeCnt = 0;
    DirectedSparseGraph<String, Integer> graph = new DirectedSparseGraph<String, Integer>();

    BufferedReader data = new BufferedReader(new InputStreamReader(new FileInputStream(infile)));

    String line;
    while ((line = data.readLine()) != null) {
        line.trim();
        String[] arr = line.split("\\t");

        for (int i = 1; i < arr.length; i++) {
            graph.addEdge(new Integer(edgeCnt++), arr[0], arr[i]);
        }
    }

    data.close();

    if (!graph.containsVertex(source)) {
        System.err.println("Error: source node not found in the graph!");
        System.exit(-1);
    }

    WeakComponentClusterer<String, Integer> clusterer = new WeakComponentClusterer<String, Integer>();

    Set<Set<String>> components = clusterer.transform(graph);
    int numComponents = components.size();
    System.out.println("Number of components: " + numComponents);
    System.out.println("Number of edges: " + graph.getEdgeCount());
    System.out.println("Number of nodes: " + graph.getVertexCount());
    System.out.println("Random jump factor: " + alpha);

    // Compute personalized PageRank.
    PageRankWithPriors<String, Integer> ranker = new PageRankWithPriors<String, Integer>(graph,
            new Transformer<String, Double>() {
                @Override
                public Double transform(String vertex) {
                    return vertex.equals(source) ? 1.0 : 0;
                }
            }, alpha);

    ranker.evaluate();

    // Use priority queue to sort vertices by PageRank values.
    PriorityQueue<Ranking<String>> q = new PriorityQueue<Ranking<String>>();
    int i = 0;
    for (String pmid : graph.getVertices()) {
        q.add(new Ranking<String>(i++, ranker.getVertexScore(pmid), pmid));
    }

    // Print PageRank values.
    System.out.println("\nPageRank of nodes, in descending order:");
    Ranking<String> r = null;
    while ((r = q.poll()) != null) {
        System.out.println(r.rankScore + "\t" + r.getRanked());
    }
}

From source file:edu.umd.shrawanraina.SequentialPersonalizedPageRank.java

@SuppressWarnings({ "static-access" })
public static void main(String[] args) throws IOException {
    Options options = new Options();

    options.addOption(OptionBuilder.withArgName("path").hasArg().withDescription("input path").create(INPUT));
    options.addOption(// w ww.j  a  v a  2 s  .co  m
            OptionBuilder.withArgName("val").hasArg().withDescription("random jump factor").create(JUMP));
    options.addOption(OptionBuilder.withArgName("node").hasArg()
            .withDescription("source node (i.e., destination of the random jump)").create(SOURCE));

    CommandLine cmdline = null;
    CommandLineParser parser = new GnuParser();

    try {
        cmdline = parser.parse(options, args);
    } catch (ParseException exp) {
        System.err.println("Error parsing command line: " + exp.getMessage());
        System.exit(-1);
    }

    if (!cmdline.hasOption(INPUT) || !cmdline.hasOption(SOURCE)) {
        System.out.println("args: " + Arrays.toString(args));
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(120);
        formatter.printHelp(SequentialPersonalizedPageRank.class.getName(), options);
        ToolRunner.printGenericCommandUsage(System.out);
        System.exit(-1);
    }

    String infile = cmdline.getOptionValue(INPUT);
    final String source = cmdline.getOptionValue(SOURCE);
    float alpha = cmdline.hasOption(JUMP) ? Float.parseFloat(cmdline.getOptionValue(JUMP)) : 0.15f;

    int edgeCnt = 0;
    DirectedSparseGraph<String, Integer> graph = new DirectedSparseGraph<String, Integer>();

    BufferedReader data = new BufferedReader(new InputStreamReader(new FileInputStream(infile)));

    String line;
    while ((line = data.readLine()) != null) {
        line.trim();
        String[] arr = line.split("\\t");

        for (int i = 1; i < arr.length; i++) {
            graph.addEdge(new Integer(edgeCnt++), arr[0], arr[i]);
        }
    }

    data.close();

    if (!graph.containsVertex(source)) {
        System.err.println("Error: source node not found in the graph!");
        System.exit(-1);
    }

    WeakComponentClusterer<String, Integer> clusterer = new WeakComponentClusterer<String, Integer>();

    Set<Set<String>> components = clusterer.transform(graph);
    int numComponents = components.size();
    System.out.println("Number of components: " + numComponents);
    System.out.println("Number of edges: " + graph.getEdgeCount());
    System.out.println("Number of nodes: " + graph.getVertexCount());
    System.out.println("Random jump factor: " + alpha);

    // Compute personalized PageRank.
    PageRankWithPriors<String, Integer> ranker = new PageRankWithPriors<String, Integer>(graph,
            new Transformer<String, Double>() {
                public Double transform(String vertex) {
                    return vertex.equals(source) ? 1.0 : 0;
                }
            }, alpha);

    ranker.evaluate();

    // Use priority queue to sort vertices by PageRank values.
    PriorityQueue<Ranking<String>> q = new PriorityQueue<Ranking<String>>();
    int i = 0;
    for (String pmid : graph.getVertices()) {
        q.add(new Ranking<String>(i++, ranker.getVertexScore(pmid), pmid));
    }

    // Print PageRank values.
    System.out.println("\nPageRank of nodes, in descending order:");
    Ranking<String> r = null;
    while ((r = q.poll()) != null) {
        System.out.println(r.rankScore + "\t" + r.getRanked());
    }
}