<commit_before>package edu.berkeley.guir.prefuse.activity;

import java.util.ArrayList;

import edu.berkeley.guir.prefuse.event.ActivityAdapter;

/**
 * <p>The ActivityManager is responsible for scheduling and running timed 
 * activities that perform graph processing and animation.</p>
 * 
 * <p>The AcivityManager runs in its own separate thread of execution, and
 * one instance is used to schedule activities from any number of currently
 * active visualizations. The class is implemented as a singleton; the single
 * instance of this class is interacted with through static methods. These
 * methods are called by an Activity's run methods, and so are made only
 * package visible here.</p>
 * 
 * <p>Activity instances can be scheduled by using their 
 * {@link edu.berkeley.guir.prefuse.activity.Activity#run() run()}, 
 * {@link edu.berkeley.guir.prefuse.activity.Activity#runNow() runNow()},
 * {@link edu.berkeley.guir.prefuse.activity.Activity#runAt(long) runAt()}, and 
 * {@link edu.berkeley.guir.prefuse.activity.Activity#runAfter(Activity) 
 * runAfter()} methods. These will automatically call the
 * appropriate methods with the ActivityManager.</p>
 *
 * @version 1.0
 * @author <a href="http://jheer.org"><NAME></a> prefuse(AT)jheer.org
 * @see Activity
 * @see ActionList
 */
public class ActivityManager extends Thread {

    private static ActivityManager s_instance;
    
    private ArrayList m_activities;
    private ArrayList m_tmp;
    private long      m_nextTime;
    
    /**
     * Returns the active ActivityManager instance.
     * @return the ActivityManager
     */
    private static ActivityManager getInstance() {
        if ( s_instance == null || !s_instance.isAlive() ) {
            s_instance = new ActivityManager();
        }
        return s_instance;
    } //
    
    /**
     * Create a new ActivityManger.
     */
    private ActivityManager() {
        super("prefuse-activity-manager");
        m_activities = new ArrayList();
        m_tmp = new ArrayList();
        m_nextTime = Long.MAX_VALUE;
        this.start();
    } //
    
    /**
     * Schedules an Activity with the manager.
     * @param a the Activity to schedule
     */
    static void schedule(Activity a) {
        getInstance()._schedule(a);
    } //<commit_msg>Made ActivityManager a daemon thread<commit_after>package edu.berkeley.guir.prefuse.activity;

import java.util.ArrayList;

import edu.berkeley.guir.prefuse.event.ActivityAdapter;

/**
 * <p>The ActivityManager is responsible for scheduling and running timed 
 * activities that perform graph processing and animation.</p>
 * 
 * <p>The AcivityManager runs in its own separate thread of execution, and
 * one instance is used to schedule activities from any number of currently
 * active visualizations. The class is implemented as a singleton; the single
 * instance of this class is interacted with through static methods. These
 * methods are called by an Activity's run methods, and so are made only
 * package visible here.</p>
 * 
 * <p>Activity instances can be scheduled by using their 
 * {@link edu.berkeley.guir.prefuse.activity.Activity#run() run()}, 
 * {@link edu.berkeley.guir.prefuse.activity.Activity#runNow() runNow()},
 * {@link edu.berkeley.guir.prefuse.activity.Activity#runAt(long) runAt()}, and 
 * {@link edu.berkeley.guir.prefuse.activity.Activity#runAfter(Activity) 
 * runAfter()} methods. These will automatically call the
 * appropriate methods with the ActivityManager.</p>
 *
 * @version 1.0
 * @author <a href="http://jheer.org"><NAME></a> prefuse(AT)jheer.org
 * @see Activity
 * @see ActionList
 */
public class ActivityManager extends Thread {

    private static ActivityManager s_instance;
    
    private ArrayList m_activities;
    private ArrayList m_tmp;
    private long      m_nextTime;
    
    /**
     * Returns the active ActivityManager instance.
     * @return the ActivityManager
     */
    private static ActivityManager getInstance() {
        if ( s_instance == null || !s_instance.isAlive() ) {
            s_instance = new ActivityManager();
        }
        return s_instance;
    } //
    
    /**
     * Create a new ActivityManger.
     */
    private ActivityManager() {
        super("prefuse_ActivityManager");
        m_activities = new ArrayList();
        m_tmp = new ArrayList();
        m_nextTime = Long.MAX_VALUE;
        
        this.setDaemon(true);
        this.start();
    } //
    
    /**
     * Schedules an Activity with the manager.
     * @param a the Activity to schedule
     */
    static void schedule(Activity a) {
        getInstance()._schedule(a);
    } //
{'fraction_non_alphanumeric': 0.10355987055016182, 'fraction_numerical': 0.0008629989212513484, 'mean_word_length': 3.095406360424028, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '1215926', 'n_tokens_mistral': 1305, 'n_tokens_neox': 1273, 'n_words': 399}