<commit_before>/*
 *  RFPhaseShakerMain.java
 *
 *  Created on Feb. 25 2009
 */
package xal.app.rfphaseshaker;

import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.net.*;

import xal.extension.application.*;
import xal.extension.smf.application.AcceleratorApplication;

/**
 *  RFPhaseShakerMain is a concrete subclass of ApplicationAdaptor for the
 *  Quad shaker application.
 *
 *@author     shishlo
 */

public class RFPhaseShakerMain extends ApplicationAdaptor {

	/**
	 *  Constructor
	 */
	public RFPhaseShakerMain() { }


	/**
	 *  Returns the text file suffixes of files this application can open.
	 *
	 *@return    Suffixes of readable files
	 */
	public String[] readableDocumentTypes() {
		return new String[]{"rfsh"};
	}


	/**
	 *  Returns the text file suffixes of files this application can write.
	 *
	 *@return    Suffixes of writable files
	 */
	public String[] writableDocumentTypes() {
		return new String[]{"rfsh"};
	}


	/**
	 *  Returns an instance of the RFPhaseShaker application document.
	 *
	 *@return    An instance of RFPhaseShaker application document.
	 */
	public XalDocument newEmptyDocument() {
		return new RFPhaseShakerDocument();
	}


	/**
	 *  Returns an instance of the RFPhaseShaker application document corresponding
	 *  to the specified URL.
	 *
	 *@param  url  The URL of the file to open.
	 *@return      An instance of an RFPhaseShaker application document.
	 */
	public XalDocument newDocument(java.net.URL url) {
		return new RFPhaseShakerDocument(url);
	}


	/**
	 *  Specifies the name of the RFPhaseShaker application.
	 *
	 *@return    Name of the application.
	 */
	public String applicationName() {
		return "RF Phase Shaker";
	}


	/**
	 *  Activates the preference panel for the RFPhaseShaker application.
	 *
	 *@param  document  The document whose preferences are being changed.
	 */
	public void editPreferences(XalDocument document) {
		((RFPhaseShakerDocument) document).editPreferences();
	}


	/**
	 *  Specifies whether the RFPhaseShaker application will send standard output
	 *  and error to the console.
	 *
	 *@return    true or false.
	 */
	public boolean usesConsole() {
		String usesConsoleProperty = System.getProperty("usesConsole");
		if(usesConsoleProperty != null) {
			return Boolean.valueOf(usesConsoleProperty).booleanValue();
		} else {
			return true;
		}
	}


	/**
	 *  The main method of the application.
	 *
	 *@param  args  The command line arguments
	 */
	public static void main(String[] args) {

		if(args.length == 0) {

			RFPhaseShakerMain doc = new RFPhaseShakerMain();

			try {
				AcceleratorApplication.launch(doc);
			} catch(Exception exception) {
				System.err.println(exception.getMessage());
				exception.printStackTrace();
				JOptionPane.showMessageDialog(null, exception.getMessage(),
						exception.getClass().getName(), JOptionPane.WARNING_MESSAGE);
			}
			return;
		}

		RFPhaseShakerMain doc = new RFPhaseShakerMain();

		URL[] predefConfURLArr = new URL[args.length];

		for(int i = 0; i < args.length; i++) {
			predefConfURLArr[i] = doc.getClass().getResource("config/" + args[i]);
		}

		try {
			AcceleratorApplication.launch(doc, predefConfURLArr);
		} catch(Exception exception) {
			System.err.println(exception.getMessage());
			exception.printStackTrace();
			JOptionPane.showMessageDialog(null, exception.getMessage(),
					exception.getClass().getName(), JOptionPane.WARNING_MESSAGE);
		}
	}
}
<commit_msg>Load the RF Phase Shaker configuration files using the application adaptor’s getResourceURL() method.<commit_after>/*
 *  RFPhaseShakerMain.java
 *
 *  Created on Feb. 25 2009
 */
package xal.app.rfphaseshaker;

import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.net.*;

import xal.extension.application.*;
import xal.extension.smf.application.AcceleratorApplication;

/**
 *  RFPhaseShakerMain is a concrete subclass of ApplicationAdaptor for the
 *  Quad shaker application.
 *
 *@author     shishlo
 */

public class RFPhaseShakerMain extends ApplicationAdaptor {

	/**
	 *  Constructor
	 */
	public RFPhaseShakerMain() { }


	/**
	 *  Returns the text file suffixes of files this application can open.
	 *
	 *@return    Suffixes of readable files
	 */
	public String[] readableDocumentTypes() {
		return new String[]{"rfsh"};
	}


	/**
	 *  Returns the text file suffixes of files this application can write.
	 *
	 *@return    Suffixes of writable files
	 */
	public String[] writableDocumentTypes() {
		return new String[]{"rfsh"};
	}


	/**
	 *  Returns an instance of the RFPhaseShaker application document.
	 *
	 *@return    An instance of RFPhaseShaker application document.
	 */
	public XalDocument newEmptyDocument() {
		return new RFPhaseShakerDocument();
	}


	/**
	 *  Returns an instance of the RFPhaseShaker application document corresponding
	 *  to the specified URL.
	 *
	 *@param  url  The URL of the file to open.
	 *@return      An instance of an RFPhaseShaker application document.
	 */
	public XalDocument newDocument(java.net.URL url) {
		return new RFPhaseShakerDocument(url);
	}


	/**
	 *  Specifies the name of the RFPhaseShaker application.
	 *
	 *@return    Name of the application.
	 */
	public String applicationName() {
		return "RF Phase Shaker";
	}


	/**
	 *  Activates the preference panel for the RFPhaseShaker application.
	 *
	 *@param  document  The document whose preferences are being changed.
	 */
	public void editPreferences(XalDocument document) {
		((RFPhaseShakerDocument) document).editPreferences();
	}


	/**
	 *  Specifies whether the RFPhaseShaker application will send standard output
	 *  and error to the console.
	 *
	 *@return    true or false.
	 */
	public boolean usesConsole() {
		String usesConsoleProperty = System.getProperty("usesConsole");
		if(usesConsoleProperty != null) {
			return Boolean.valueOf(usesConsoleProperty).booleanValue();
		} else {
			return true;
		}
	}


	/**
	 *  The main method of the application.
	 *
	 *@param  args  The command line arguments
	 */
	public static void main(String[] args) {
		final RFPhaseShakerMain appAdaptor = new RFPhaseShakerMain();
		URL[] predefConfURLArr = null;


		if ( args.length == 0 ) {
			predefConfURLArr = new URL[0];
		}
		else {
			predefConfURLArr = new URL[args.length];
			for ( int index = 0; index < args.length; index++ ) {
				predefConfURLArr[index] = appAdaptor.getResourceURL( "config/" + args[index] );
			}
		}

		try {
			AcceleratorApplication.launch( appAdaptor, predefConfURLArr );
		}
		catch (Exception exception) {
			System.err.println(exception.getMessage());
			exception.printStackTrace();
			JOptionPane.showMessageDialog( null, exception.getMessage(), exception.getClass().getName(), JOptionPane.WARNING_MESSAGE );
		}
	}
}

{'fraction_non_alphanumeric': 0.10662144226515263, 'fraction_numerical': 0.0025070048665388586, 'mean_word_length': 3.626193724420191, 'pattern_counts': {'":': 0, '<': 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': '533127', 'n_tokens_mistral': 2205, 'n_tokens_neox': 1969, 'n_words': 570}