<commit_before>/*
 * Main.java
 * Copyright (c) 2004 The Prevayler Team
 * 
 * See distributed LICENSE file for licensing details.
 */
package org.prevayler.tutorial;

import java.util.Iterator;

import org.prevayler.Prevayler;
import org.prevayler.PrevaylerFactory;

/**
 * 2-Minute Tutorial Main-Class.
 * 
 * @author <NAME>
 * @since Mar 7, 2004
 */
public class Main {

    public static void main(String[] args) throws Exception {
        // START SNIPPET: creating
        // Let's create a new TaskList. This is our 'prevalent system'.
        TaskList list = new TaskList();

        // Create a new prevayler. /tasklist-base is the tx-log directory.
        Prevayler prevayler = PrevaylerFactory.createPrevayler(list, "/tasklist-base");

        /*
         * IMPORTANT: Your prevalent system is going to be empty after a
         * snapshot if you don't reassign it here.
         */
        list = (TaskList) prevayler.prevalentSystem();
        // END SNIPPET: creating

        System.out.println("Tasks: " + list.getTasks().size() + ", adding ");

        // START SNIPPET: adding
        Task dishes = (Task) prevayler.execute(new AddTask("do the dishes", Task.MAX_PRIORITY));
        Task dog = (Task) prevayler.execute(new AddTask("walk the dog", Task.MED_PRIORITY));
        Task laundry = (Task) prevayler.execute(new AddTask("do the laundry", Task.MIN_PRIORITY));
        // END SNIPPET: adding

        // START SNIPPET: iterating
        for (Iterator i = list.getTasks().iterator(); i.hasNext();) {
            Task t = (Task) i.next();
            System.out.println("Task: " + t.getDescription() + ", " + t.getPriority());
        }
        // END SNIPPET: iterating

        System.out.println("Tasks: " + list.getTasks().size() + ", removing...");

        // START SNIPPET: removing
        prevayler.execute(new RemoveTask(dishes));
        prevayler.execute(new RemoveTask(dog));
        prevayler.execute(new RemoveTask(laundry));
        // END SNIPPET: removing
        
        System.out.println("Tasks: " + list.getTasks().size());

        // START SNIPPET: snapshotting
        prevayler.takeSnapshot();
        // END SNIPPET: snapshotting
    }
}
<commit_msg>Changed creation code to match Jon's suggestion.<commit_after>/*
 * Main.java
 * Copyright (c) 2004 The Prevayler Team
 * 
 * See distributed LICENSE file for licensing details.
 */
package org.prevayler.tutorial;

import java.util.Iterator;

import org.prevayler.Prevayler;
import org.prevayler.PrevaylerFactory;

/**
 * 2-Minute Tutorial Main-Class.
 * 
 * @author <NAME>
 * @since Mar 7, 2004
 */
public class Main {

    public static void main(String[] args) throws Exception {
        // START SNIPPET: creating
        // Create a new prevayler. /tasklist-base is the tx-log directory.
        Prevayler prevayler = PrevaylerFactory.createPrevayler(new TaskList(), "/tasklist-base");
        TaskList list = (TaskList) prevayler.prevalentSystem();
        // END SNIPPET: creating

        System.out.println("Tasks: " + list.getTasks().size() + ", adding ");

        // START SNIPPET: adding
        Task dishes = (Task) prevayler.execute(new AddTask("do the dishes", Task.MAX_PRIORITY));
        Task dog = (Task) prevayler.execute(new AddTask("walk the dog", Task.MED_PRIORITY));
        Task laundry = (Task) prevayler.execute(new AddTask("do the laundry", Task.MIN_PRIORITY));
        // END SNIPPET: adding

        // START SNIPPET: iterating
        for (Iterator i = list.getTasks().iterator(); i.hasNext();) {
            Task t = (Task) i.next();
            System.out.println("Task: " + t.getDescription() + ", " + t.getPriority());
        }
        // END SNIPPET: iterating

        System.out.println("Tasks: " + list.getTasks().size() + ", removing...");

        // START SNIPPET: removing
        prevayler.execute(new RemoveTask(dishes));
        prevayler.execute(new RemoveTask(dog));
        prevayler.execute(new RemoveTask(laundry));
        // END SNIPPET: removing
        
        System.out.println("Tasks: " + list.getTasks().size());

        // START SNIPPET: snapshotting
        prevayler.takeSnapshot();
        // END SNIPPET: snapshotting
    }
}

{'fraction_non_alphanumeric': 0.13260195564035296, 'fraction_numerical': 0.004769854519437157, 'mean_word_length': 2.5602716468590834, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1878776', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1237, 'n_words': 318}