Search in sources :

Example 16 with Transaction

use of com.google.spanner.v1.Transaction in project algorithms-sedgewick-wayne by reneargento.

the class Exercise17 method main.

public static void main(String[] args) {
    String transactionFilePath = args[0];
    Transaction[] transactions = readAllTransactions(transactionFilePath);
    for (Transaction transaction : transactions) {
        StdOut.println(transaction);
    }
}
Also used : Transaction(edu.princeton.cs.algs4.Transaction)

Example 17 with Transaction

use of com.google.spanner.v1.Transaction in project algorithms-sedgewick-wayne by reneargento.

the class Exercise17 method readAllTransactions.

public static Transaction[] readAllTransactions(String fileName) {
    In in = new In(fileName);
    Queue<Transaction> queue = new Queue<>();
    while (!in.isEmpty()) {
        queue.enqueue(new Transaction(in.readLine()));
    }
    int queueSize = queue.size();
    Transaction[] transactions = new Transaction[queueSize];
    for (int i = 0; i < queueSize; i++) {
        transactions[i] = queue.dequeue();
    }
    return transactions;
}
Also used : Transaction(edu.princeton.cs.algs4.Transaction) In(edu.princeton.cs.algs4.In) Queue(edu.princeton.cs.algs4.Queue)

Aggregations

Test (org.junit.Test)9 Transaction (org.neo4j.driver.v1.Transaction)9 Session (org.neo4j.driver.v1.Session)8 Driver (org.neo4j.driver.v1.Driver)6 Record (org.neo4j.driver.v1.Record)6 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)5 CoreClusterMember (org.neo4j.causalclustering.discovery.CoreClusterMember)5 RoutingNetworkSession (org.neo4j.driver.internal.RoutingNetworkSession)5 Transaction (edu.princeton.cs.algs4.Transaction)4 PartialResultSet (com.google.spanner.v1.PartialResultSet)3 Transaction (com.google.spanner.v1.Transaction)3 In (edu.princeton.cs.algs4.In)2 Queue (edu.princeton.cs.algs4.Queue)2 ReadReplica (org.neo4j.causalclustering.discovery.ReadReplica)2 StatementResult (org.neo4j.driver.v1.StatementResult)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Stack (com.jimmysun.algorithms.chapter1_3.Stack)1 Transaction (com.jimmysun.algorithms.chapter2_1.Transaction)1 MinPQ (edu.princeton.cs.algs4.MinPQ)1 IOException (java.io.IOException)1