<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package openecho.time;

import java.util.logging.Level;
import java.util.logging.Logger;
import junit.framework.TestCase;

/**
 *
 * @author jmarsden
 */
public class RepeatActionThreadTest extends TestCase {
    
    public RepeatActionThreadTest(String testName) {
        super(testName);
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
    }

    @Override
    protected void tearDown() throws Exception {
        super.tearDown();
    }

    /**
     * Test of getCurrentState method, of class RepeatActionThread.
     */
    public void testRunInstance() {
        System.out.println("getCurrentState");
        RepeatActionThread instance = new RepeatActionThread(1);
        instance.registerAction(new TestRepeatableAction());
        instance.start();
        for(int i=0;i<4;i++) {
            try {
                Thread.sleep(500);
            } catch (InterruptedException ex) {
                Logger.getLogger(RepeatActionThreadTest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        instance.stop();
    }

    public class TestRepeatableAction extends RepeatedAction {

    Timer timer = Timer.getInstance();
    StopWatch stopWatch = new StopWatch(timer);

    @Override
    public String getName() {
        return "TestRepeatableAction";

    }

    @Override
    protected void handleExecute(long tick) throws ActionException {
        stopWatch.stop();
        System.out.println(this.getClass().getName() + " - tick " + tick + ":\t" + Timer.nanoSecondsToReadableMilliSeconds(stopWatch.getDeltaNanoTime()));
        stopWatch.start();
    }

    
}
}<commit_msg>Format<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package openecho.time;

import java.util.logging.Level;
import java.util.logging.Logger;
import junit.framework.TestCase;

/**
 *
 * @author jmarsden
 */
public class RepeatActionThreadTest extends TestCase {

    public RepeatActionThreadTest(String testName) {
        super(testName);
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
    }

    @Override
    protected void tearDown() throws Exception {
        super.tearDown();
    }

    /**
     * Test of getCurrentState method, of class RepeatActionThread.
     */
    public void testRunInstance() {
        System.out.println("getCurrentState");
        RepeatActionThread instance = new RepeatActionThread(1);
        instance.registerAction(new TestRepeatableAction());
        instance.start();
        for (int i = 0; i < 4; i++) {
            try {
                Thread.sleep(500);
            } catch (InterruptedException ex) {
                Logger.getLogger(RepeatActionThreadTest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        instance.stop();
    }

    public class TestRepeatableAction extends RepeatedAction {

        Timer timer = Timer.getInstance();
        StopWatch stopWatch = new StopWatch(timer);

        @Override
        public String getName() {
            return "TestRepeatableAction";

        }

        @Override
        protected void handleExecute(long tick) throws ActionException {
            stopWatch.stop();
            System.out.println(this.getClass().getName() + " - tick " + tick + ":\t" + Timer.nanoSecondsToReadableMilliSeconds(stopWatch.getDeltaNanoTime()));
            stopWatch.start();
        }
    }
}
{'fraction_non_alphanumeric': 0.10661456879709741, 'fraction_numerical': 0.0033491487580240022, 'mean_word_length': 2.4829931972789114, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 3, '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': '1213858', 'n_tokens_mistral': 1001, 'n_tokens_neox': 963, 'n_words': 223}