Added package-info.java to all packages

Some more refactoring
This commit is contained in:
Fabian Becker 2013-10-12 19:38:34 +02:00
parent 5a7b0fe429
commit 35044c2a1c
64 changed files with 51 additions and 67 deletions

View File

View File

View File

View File

View File

View File

View File

View File

View File

@ -1,20 +1,4 @@
package eva2.tools; package eva2.tools;
/**
* Title: EvA2
* Description:
* Copyright: Copyright (c) 2003
* Company: University of Tuebingen, Computer Architecture
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
* @version: $Revision: 10 $
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $
* $Author: streiche $
*/
/*==========================================================================*
* IMPORTS
*==========================================================================*/
/*==========================================================================*
* CLASS DECLARATION
*==========================================================================*/
/** /**
* This class represents a cluster object in the R^N. * This class represents a cluster object in the R^N.

View File

@ -30,16 +30,16 @@ import java.util.Vector;
*/ */
public class MultirunRefiner { public class MultirunRefiner {
private JFrame m_Frame; private JFrame mainFrame;
private JPanel myPanel, myJButtonJPanel; private JPanel myPanel, myJButtonJPanel;
private JButton refineJButton, exitJButton; private JButton refineJButton, exitJButton;
// private JButton confidenceJButton; // private JButton confidenceJButton;
private JTextArea m_InputText, m_OutputText; private JTextArea inputText, outputText;
private JScrollPane m_SP1, m_SP2; private JScrollPane m_SP1, m_SP2;
private JMenuBar m_MenuBar; private JMenuBar menuBar;
private JMenu m_FileJMenu; private JMenu fileMenu;
private JMenuItem m_LoadExpItem, m_SaveExpItem; private JMenuItem loadMenuItem, saveMenuItem;
private JMenuItem m_ExitItem; private JMenuItem exitMenuItem;
/** /**
* Creates a new instance of MultirunRefiner * Creates a new instance of MultirunRefiner
@ -65,49 +65,49 @@ public class MultirunRefiner {
public MultirunRefiner(String text, int numRuns) { public MultirunRefiner(String text, int numRuns) {
starter(); starter();
m_InputText.setText(text); inputText.setText(text);
} }
public void starter() { public void starter() {
this.m_Frame = new JFrame("MultirunRefiner\u2122"); this.mainFrame = new JFrame("MultirunRefiner\u2122");
// The menuebar // The menuebar
this.m_MenuBar = new JMenuBar(); this.menuBar = new JMenuBar();
this.m_FileJMenu = new JMenu("File"); this.fileMenu = new JMenu("File");
this.m_LoadExpItem = new JMenuItem("Load"); this.loadMenuItem = new JMenuItem("Load");
this.m_LoadExpItem.setEnabled(true); this.loadMenuItem.setEnabled(true);
this.m_LoadExpItem.addActionListener(new ActionListener() { this.loadMenuItem.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent ev) { public void actionPerformed(ActionEvent ev) {
loadFile(); loadFile();
} }
}); });
this.m_SaveExpItem = new JMenuItem("Save"); this.saveMenuItem = new JMenuItem("Save");
this.m_SaveExpItem.setEnabled(true); this.saveMenuItem.setEnabled(true);
this.m_SaveExpItem.addActionListener(new java.awt.event.ActionListener() { this.saveMenuItem.addActionListener(new java.awt.event.ActionListener() {
@Override @Override
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
writeFile(); writeFile();
} }
}); });
this.m_ExitItem = new JMenuItem("Exit"); this.exitMenuItem = new JMenuItem("Exit");
this.m_ExitItem.setEnabled(true); this.exitMenuItem.setEnabled(true);
this.m_ExitItem.addActionListener(new java.awt.event.ActionListener() { this.exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
@Override @Override
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0); System.exit(0);
} }
}); });
this.m_FileJMenu.add(this.m_LoadExpItem); this.fileMenu.add(this.loadMenuItem);
this.m_FileJMenu.add(this.m_SaveExpItem); this.fileMenu.add(this.saveMenuItem);
this.m_MenuBar.add(this.m_FileJMenu); this.menuBar.add(this.fileMenu);
this.m_MenuBar.add(this.m_ExitItem); this.menuBar.add(this.exitMenuItem);
this.m_Frame.setJMenuBar(this.m_MenuBar); this.mainFrame.setJMenuBar(this.menuBar);
this.m_Frame.setSize(300, 300); this.mainFrame.setSize(300, 300);
this.m_Frame.setLocation(0, 150); this.mainFrame.setLocation(0, 150);
this.m_Frame.addWindowListener(new WindowAdapter() { this.mainFrame.addWindowListener(new WindowAdapter() {
@Override @Override
public void windowClosing(WindowEvent ev) { public void windowClosing(WindowEvent ev) {
System.exit(0); System.exit(0);
@ -116,23 +116,23 @@ public class MultirunRefiner {
this.myPanel = new JPanel(); this.myPanel = new JPanel();
this.myPanel.setLayout(new GridLayout(1, 2)); this.myPanel.setLayout(new GridLayout(1, 2));
this.m_InputText = new JTextArea(); this.inputText = new JTextArea();
this.m_OutputText = new JTextArea(); this.outputText = new JTextArea();
this.m_SP1 = new JScrollPane(this.m_InputText); this.m_SP1 = new JScrollPane(this.inputText);
this.m_SP2 = new JScrollPane(this.m_OutputText); this.m_SP2 = new JScrollPane(this.outputText);
this.myPanel.add(this.m_SP1); this.myPanel.add(this.m_SP1);
this.myPanel.add(this.m_SP2); this.myPanel.add(this.m_SP2);
this.m_Frame.getContentPane().add(this.myPanel, BorderLayout.CENTER); this.mainFrame.getContentPane().add(this.myPanel, BorderLayout.CENTER);
this.myJButtonJPanel = new JPanel(); this.myJButtonJPanel = new JPanel();
this.myJButtonJPanel.setLayout(new GridLayout(2, 2)); this.myJButtonJPanel.setLayout(new GridLayout(2, 2));
this.m_Frame.getContentPane().add(this.myJButtonJPanel, BorderLayout.SOUTH); this.mainFrame.getContentPane().add(this.myJButtonJPanel, BorderLayout.SOUTH);
refineJButton = new JButton("Refine Multiruns"); refineJButton = new JButton("Refine Multiruns");
refineJButton.addMouseListener(new java.awt.event.MouseAdapter() { refineJButton.addMouseListener(new java.awt.event.MouseAdapter() {
@Override @Override
public void mouseClicked(java.awt.event.MouseEvent evt) { public void mouseClicked(java.awt.event.MouseEvent evt) {
m_OutputText.setText(refineToText(refine(m_InputText.getText()))); outputText.setText(refineToText(refine(inputText.getText())));
} }
}); });
// confidenceJButton = new JButton("Create Matlab/Confidence"); // confidenceJButton = new JButton("Create Matlab/Confidence");
@ -152,8 +152,8 @@ public class MultirunRefiner {
// this.myJButtonJPanel.add(confidenceJButton); // this.myJButtonJPanel.add(confidenceJButton);
this.myJButtonJPanel.add(exitJButton); this.myJButtonJPanel.add(exitJButton);
m_Frame.validate(); mainFrame.validate();
m_Frame.setVisible(true); mainFrame.setVisible(true);
} }
/** /**
@ -164,10 +164,10 @@ public class MultirunRefiner {
JFileChooser fc = new JFileChooser(); JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Select an Multirun.TXT File"); fc.setDialogTitle("Select an Multirun.TXT File");
fc.setFileFilter(new TXTFileFilter()); fc.setFileFilter(new TXTFileFilter());
int returnVal = fc.showDialog(this.m_Frame, "Load Multirun.TXT"); int returnVal = fc.showDialog(this.mainFrame, "Load Multirun.TXT");
if (returnVal == 0) { if (returnVal == 0) {
readFile(fc.getSelectedFile()); readFile(fc.getSelectedFile());
this.m_Frame.validate(); this.mainFrame.validate();
} }
} }
@ -176,7 +176,7 @@ public class MultirunRefiner {
clearInputText(); clearInputText();
try { try {
fileStream = new FileReader(f); fileStream = new FileReader(f);
this.m_InputText.read(fileStream, f); this.inputText.read(fileStream, f);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
@ -187,15 +187,15 @@ public class MultirunRefiner {
} }
public void clearInputText() { public void clearInputText() {
this.m_InputText.setText(""); this.inputText.setText("");
} }
public void clearOutputText() { public void clearOutputText() {
this.m_OutputText.setText(""); this.outputText.setText("");
} }
public void addOutputText(String t) { public void addOutputText(String t) {
this.m_OutputText.setText(this.m_OutputText.getText() + t); this.outputText.setText(this.outputText.getText() + t);
} }
/** /**
@ -208,11 +208,11 @@ public class MultirunRefiner {
JFileChooser fc = new JFileChooser(); JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Select destination file"); fc.setDialogTitle("Select destination file");
fc.setFileFilter(new TXTFileFilter()); fc.setFileFilter(new TXTFileFilter());
int returnVal = fc.showSaveDialog(this.m_Frame); int returnVal = fc.showSaveDialog(this.mainFrame);
if (returnVal == 0) { if (returnVal == 0) {
try { try {
FileWriter fileStream = new FileWriter(fc.getSelectedFile()); FileWriter fileStream = new FileWriter(fc.getSelectedFile());
this.m_OutputText.write(fileStream); this.outputText.write(fileStream);
} catch (java.io.IOException ioe) { } catch (java.io.IOException ioe) {
} }
} }
@ -319,11 +319,11 @@ public class MultirunRefiner {
// ArrayList result = new ArrayList(), tmpA; // ArrayList result = new ArrayList(), tmpA;
// //
// this.clearOutputText(); // this.clearOutputText();
// for (int i = 0; i < this.m_InputText.getLineCount(); i++) { // for (int i = 0; i < this.inputText.getLineCount(); i++) {
// try { // try {
// begin = this.m_InputText.getLineStartOffset(i); // begin = this.inputText.getLineStartOffset(i);
// end = this.m_InputText.getLineEndOffset(i); // end = this.inputText.getLineEndOffset(i);
// tmp = this.parseStringForDouble(this.m_InputText.getText(begin, end-begin)); // tmp = this.parseStringForDouble(this.inputText.getText(begin, end-begin));
// if (tmp.length > 3) { // if (tmp.length > 3) {
// if (((int)(tmp[0])) == 1) numExp++; // if (((int)(tmp[0])) == 1) numExp++;
// if (result.size()-1 < ((int)(tmp[0]))) result.add(((int)(tmp[0])), new double[3]); // if (result.size()-1 < ((int)(tmp[0]))) result.add(((int)(tmp[0])), new double[3]);
@ -334,7 +334,7 @@ public class MultirunRefiner {
// } // }
// } catch (javax.swing.text.BadLocationException ble){} // } catch (javax.swing.text.BadLocationException ble){}
// } // }
// System.out.println(this.m_InputText.getLineCount() + " lines parsed. " + numExp + " experiments with " + result.size() + " events each."); // System.out.println(this.inputText.getLineCount() + " lines parsed. " + numExp + " experiments with " + result.size() + " events each.");
// this.addOutputText("Event\tBest\tMean\tWorst\n"); // this.addOutputText("Event\tBest\tMean\tWorst\n");
// for(int i = 0; i < result.size(); i++) { // for(int i = 0; i < result.size(); i++) {
// mean = ((double[])(result.get(i))); // mean = ((double[])(result.get(i)));
@ -345,7 +345,7 @@ public class MultirunRefiner {
/** /**
* A simple method to read doubles from a string. * A simple method to read doubles from a string.
* *
* @param String The string to be searched. * @param searchme The string to be searched.
* @return The array of doubles found. * @return The array of doubles found.
*/ */
public static double[] parseStringForDouble(String searchme) { public static double[] parseStringForDouble(String searchme) {

View File

View File

View File

@ -33,7 +33,7 @@ public class StatisticUtils {
double av1 = 0.0, av2 = 0.0, y11 = 0.0, y22 = 0.0, y12 = 0.0, c; double av1 = 0.0, av2 = 0.0, y11 = 0.0, y22 = 0.0, y12 = 0.0, c;
int n = y1.length; int n = y1.length;
if (n != y2.length) { if (n != y2.length) {
throw new RuntimeException("Error, mismatching vectors for correlation calculation in StatisticUtils.correlation(double[], double[])"); throw new IllegalArgumentException("Error, mismatching vectors for correlation calculation in StatisticUtils.correlation(double[], double[])");
} }
if (n <= 1) { if (n <= 1) {

View File

View File

View File

View File

View File

0
src/package-info.java Normal file
View File

View File