Search in sources :

Example 16 with Transaction

use of edu.princeton.cs.algs4.Transaction in project algorithms-sedgewick-wayne by reneargento.

the class Exercise22_TransactionSortTest method main.

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

Example 17 with Transaction

use of edu.princeton.cs.algs4.Transaction in project algorithms-sedgewick-wayne by reneargento.

the class Exercise22_TransactionSortTest 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)

Example 18 with Transaction

use of edu.princeton.cs.algs4.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 19 with Transaction

use of edu.princeton.cs.algs4.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)

Example 20 with Transaction

use of edu.princeton.cs.algs4.Transaction in project algorithms-sedgewick-wayne by reneargento.

the class Exercise19_2_Parsing method main.

public static void main(String[] args) {
    Date date = new Date(8, 5, 2016);
    Exercise19_2_Parsing transaction = new Exercise19_2_Parsing("Turing", date, 22.10);
    StdOut.println(transaction);
    StdOut.println("Expected: Turing spent 22.1 on 8/5/2016");
}
Also used : Date(edu.princeton.cs.algs4.Date)

Aggregations

Test (org.junit.Test)8 Transaction (org.neo4j.driver.v1.Transaction)8 Session (org.neo4j.driver.v1.Session)7 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 Driver (org.neo4j.driver.v1.Driver)5 Date (edu.princeton.cs.algs4.Date)4 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 Exercise21_ComparableTransactions (chapter2.section1.Exercise21_ComparableTransactions)1 Stack (com.jimmysun.algorithms.chapter1_3.Stack)1 Transaction (com.jimmysun.algorithms.chapter2_1.Transaction)1 MinPQ (edu.princeton.cs.algs4.MinPQ)1 HashSet (java.util.HashSet)1