<commit_before>package org.csstudio.channelfinder.util;

import gov.bnl.channelfinder.api.Channel;
import gov.bnl.channelfinder.api.ChannelFinderClient;

import java.util.Collection;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Map;
import java.util.logging.Logger;

import org.csstudio.channelfinder.views.ChannelFinderView;
import org.csstudio.utility.channel.ICSSChannel;
import org.csstudio.utility.channel.ICSSChannelFactory;
import org.csstudio.utility.channel.nsls2.CSSChannelFactory;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.ui.PlatformUI;

public class FindChannels extends Job {
	private String searchPattern;
	private ChannelFinderView channelFinderView;
	private static Logger logger = Logger.getLogger("org.csstudio.channelfinder.views.FindChannels");

	public FindChannels(String name, String pattern,
			ChannelFinderView channelFinderView) {
		super(name);
		this.searchPattern = pattern;
		this.channelFinderView = channelFinderView;
	}

	@Override
	protected IStatus run(IProgressMonitor monitor) {
		monitor.beginTask("Seaching channels ", IProgressMonitor.UNKNOWN);
		final Collection<Channel> channels = new HashSet<Channel>();
		try {
			if(searchPattern.startsWith("sim:"))
				channels.addAll(GenerateTestChannels.getChannels(Integer.valueOf(searchPattern.split("sim:")[1])));
			else
				channels.addAll(ChannelFinderClient.getInstance().findChannels(buildSearchMap(searchPattern)));
			PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
				@Override
				public void run() {
					// TODO return set of channels sorted by name
					// each channel has its properties and tags sorted by name.
					channelFinderView.updateList(channels);
				}
			});
		} catch (Exception e) {<commit_msg>..display.channelfinderviewer: add test channels by using sim://(# of test channels) in search field<commit_after>package org.csstudio.channelfinder.util;

import gov.bnl.channelfinder.api.Channel;
import gov.bnl.channelfinder.api.ChannelFinderClient;

import java.util.Collection;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Map;
import java.util.logging.Logger;

import org.csstudio.channelfinder.views.ChannelFinderView;
import org.csstudio.utility.channel.ICSSChannel;
import org.csstudio.utility.channel.ICSSChannelFactory;
import org.csstudio.utility.channel.nsls2.CSSChannelFactory;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.ui.PlatformUI;

public class FindChannels extends Job {
	private String searchPattern;
	private ChannelFinderView channelFinderView;
	private static Logger logger = Logger.getLogger("org.csstudio.channelfinder.views.FindChannels");

	public FindChannels(String name, String pattern,
			ChannelFinderView channelFinderView) {
		super(name);
		this.searchPattern = pattern;
		this.channelFinderView = channelFinderView;
	}

	@Override
	protected IStatus run(IProgressMonitor monitor) {
		monitor.beginTask("Seaching channels ", IProgressMonitor.UNKNOWN);
		final Collection<Channel> channels = new HashSet<Channel>();
		try {
			if(searchPattern.startsWith("sim://"))
				channels.addAll(GenerateTestChannels.getChannels(Integer.valueOf(searchPattern.split("sim://")[1])));
			else
				channels.addAll(ChannelFinderClient.getInstance().findChannels(buildSearchMap(searchPattern)));
			PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
				@Override
				public void run() {
					// TODO return set of channels sorted by name
					// each channel has its properties and tags sorted by name.
					channelFinderView.updateList(channels);
				}
			});
		} catch (Exception e) {
{'fraction_non_alphanumeric': 0.10566812003077712, 'fraction_numerical': 0.0010259040779687098, 'mean_word_length': 5.543624161073826, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4946316', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1169, 'n_words': 228}