<commit_before>package twitchUpdate;

import java.util.ArrayList;

import twitchlsgui.GenericStream;
import twitchlsgui.Main_GUI;
import twitchlsgui.OptionsPanel;
import twitchlsgui.TwitchStream;

/**
 * 
 * @author Niklas 28.06.2014
 * 
 */
public class StreamCheck implements Runnable {

    private static ArrayList<Thread> threads = new ArrayList<Thread>();
    private static ArrayList<GenericStream> streamList;

    @Override
    public void run() {
	while (true) {
	    if (Main_GUI.autoUpdate) {
		update();
	    }
	    try {
		Thread.sleep(Main_GUI.checkTimer * 1000);
	    } catch (InterruptedException e) {
		e.printStackTrace();
	    }
	}

    }

    public static void update() {
	streamList = Main_GUI.selectStreamService("twitch.tv").getStreamList();

	if (streamList.size() > 0) {
	    if (Main_GUI.currentStreamService.equals(Main_GUI
		    .selectStreamService("twitch.tv").getUrl())) {
		Main_GUI.updateStatus.setText("Updating");
	    } else {
		Main_GUI.updateStatus.setText("");
	    }

	    for (int i = 0; i < streamList.size(); i++) {
		threads.add(new Thread(new CheckThread(i, streamList)));
	    }
	    for (int i = 0; i < streamList.size(); i++) {
		threads.get(i).start();
	    }
	    for (int i = 0; i < streamList.size(); i++) {
		try {
		    threads.get(i).join();
		} catch (InterruptedException e) {
		    e.printStackTrace();
		}
	    }
	    for (int i = 0; i < Main_GUI.streamListModel.getSize(); i++) {
		Main_GUI.streamListModel.setElementAt(
			Main_GUI.streamListModel.getElementAt(i), i);
	    }
	}

	if (Main_GUI.currentStreamService.equals(Main_GUI.selectStreamService(
		"twitch.tv").getUrl())) {
	    Main_GUI.updateStatus.setText("Finished updating");
	} else {
	    Main_GUI.updateStatus.setText("");
	}
	if (Main_GUI.currentStreamName != "") {
	    if (Main_GUI.currentStreamService.equals(Main_GUI
		    .selectStreamService("twitch.tv").getUrl())) {
		for (int i = 0; i < streamList.size(); i++) {
		    TwitchStream ts = (TwitchStream) streamList.get(i);
		    if (ts.getChannel().equals(Main_GUI.currentStreamName)) {
			if (ts.isOnline()) {
			    Main_GUI.onlineStatus.setText(ts.getOnlineString());
			    Main_GUI.setPreviewImage(ts.getPreview());
			} else {
			    Main_GUI.onlineStatus.setText("Stream is Offline");
			}
		    }
		}
	    } else {
		Main_GUI.onlineStatus.setText("");
	    }

	}
	threads = new ArrayList<Thread>();
	OptionsPanel.KBLabel.setText(Main_GUI.downloadedBytes / 1000 + "");
	Main_GUI.downloadedBytes = 0;
    }

}<commit_msg>changes from last commit<commit_after>package twitchUpdate;

import java.util.ArrayList;

import twitchlsgui.GenericStream;
import twitchlsgui.Main_GUI;
import twitchlsgui.OptionsPanel;
import twitchlsgui.TwitchStream;

/**
 * 
 * @author Niklas 28.06.2014
 * 
 */
public class StreamCheck implements Runnable {

    private static ArrayList<Thread> threads = new ArrayList<Thread>();
    private static ArrayList<GenericStream> streamList;

    @Override
    public void run() {
	while (true) {
	    if (Main_GUI.autoUpdate) {
		update();
	    }
	    try {
		Thread.sleep(Main_GUI.checkTimer * 1000);
	    } catch (InterruptedException e) {
		e.printStackTrace();
	    }
	}

    }

    public static void update() {
	Main_GUI.canUpdate = false;
	streamList = Main_GUI.selectStreamService("twitch.tv").getStreamList();

	if (streamList.size() > 0) {
	    if (Main_GUI.currentStreamService.equals(Main_GUI
		    .selectStreamService("twitch.tv").getUrl())) {
		Main_GUI.updateStatus.setText("Updating");
	    } else {
		Main_GUI.updateStatus.setText("");
	    }

	    for (int i = 0; i < streamList.size(); i++) {
		threads.add(new Thread(new CheckThread(i, streamList)));
	    }
	    for (int i = 0; i < streamList.size(); i++) {
		threads.get(i).start();
	    }
	    for (int i = 0; i < streamList.size(); i++) {
		try {
		    threads.get(i).join();
		} catch (InterruptedException e) {
		    e.printStackTrace();
		}
	    }
	    for (int i = 0; i < Main_GUI.streamListModel.getSize(); i++) {
		Main_GUI.streamListModel.setElementAt(
			Main_GUI.streamListModel.getElementAt(i), i);
	    }
	}

	if (Main_GUI.currentStreamService.equals(Main_GUI.selectStreamService(
		"twitch.tv").getUrl())) {
	    Main_GUI.updateStatus.setText("Finished updating");
	} else {
	    Main_GUI.updateStatus.setText("");
	}
	if (Main_GUI.currentStreamName != "") {
	    if (Main_GUI.currentStreamService.equals(Main_GUI
		    .selectStreamService("twitch.tv").getUrl())) {
		for (int i = 0; i < streamList.size(); i++) {
		    TwitchStream ts = (TwitchStream) streamList.get(i);
		    if (ts.getChannel().equals(Main_GUI.currentStreamName)) {
			if (ts.isOnline()) {
			    Main_GUI.onlineStatus.setText(ts.getOnlineString());
			    Main_GUI.setPreviewImage(ts.getPreview());
			} else {
			    Main_GUI.onlineStatus.setText("Stream is Offline");
			}
		    }
		}
	    } else {
		Main_GUI.onlineStatus.setText("");
	    }

	}
	threads = new ArrayList<Thread>();
	OptionsPanel.KBLabel.setText(Main_GUI.downloadedBytes / 1000 + "");
	System.out.println(Main_GUI.downloadedBytes);
	Main_GUI.downloadedBytes = 0;
	System.out.println(Main_GUI.downloadedBytes);
	Main_GUI.canUpdate = true;
    }

}
{'fraction_non_alphanumeric': 0.14731970690320093, 'fraction_numerical': 0.00887003470883147, 'mean_word_length': 3.4792746113989637, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4020496', 'n_tokens_mistral': 1904, 'n_tokens_neox': 1704, 'n_words': 299}