Remove hostname from Main

This commit is contained in:
Fabian Becker 2014-10-31 10:54:51 +01:00
parent 802a36eb60
commit ba814ec492

View File

@ -90,8 +90,8 @@ public class Main extends JFrame implements OptimizationStateListener {
* that the Main initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()} } * that the Main initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()} }
* to await full initialization if necessary. * to await full initialization if necessary.
*/ */
public Main(final String hostName) { public Main() {
this(hostName, null, false, false); this(null, false, false);
} }
/** /**
@ -100,13 +100,12 @@ public class Main extends JFrame implements OptimizationStateListener {
* efficiency. Use {@link #awaitClientInitialized()} to await full * efficiency. Use {@link #awaitClientInitialized()} to await full
* initialization if necessary. * initialization if necessary.
* *
* @param hostName
* @param paramsFile * @param paramsFile
* @param autorun * @param autorun
* @param nosplash * @param nosplash
*/ */
public Main(final String hostName, final String paramsFile, boolean autorun, boolean nosplash) { public Main(final String paramsFile, boolean autorun, boolean nosplash) {
this(hostName, null, paramsFile, null, autorun, nosplash, false, false); this(null, paramsFile, null, autorun, nosplash, false, false);
} }
/** /**
@ -114,13 +113,12 @@ public class Main extends JFrame implements OptimizationStateListener {
* initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()} * initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()}
* to await full initialization if necessary. * to await full initialization if necessary.
* *
* @param hostName
* @param autorun * @param autorun
* @param nosplash * @param nosplash
* @see #Main(String, String, boolean, boolean) * @see #Main(String, boolean, boolean)
*/ */
public Main(final String hostName, boolean autorun, boolean nosplash) { public Main(boolean autorun, boolean nosplash) {
this(hostName, null, autorun, nosplash); this(null, autorun, nosplash);
} }
/** /**
@ -128,15 +126,14 @@ public class Main extends JFrame implements OptimizationStateListener {
* initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()} * initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()}
* to await full initialization if necessary. * to await full initialization if necessary.
* *
* @param hostName
* @param paramsFile * @param paramsFile
* @param autorun * @param autorun
* @param noSplash * @param noSplash
* @param noGui * @param noGui
* @see #Main(String, String, boolean, boolean) * @see #Main(boolean, boolean)
*/ */
public Main(final String hostName, String paramsFile, boolean autorun, boolean noSplash, boolean noGui, boolean withTreeView) { public Main(String paramsFile, boolean autorun, boolean noSplash, boolean noGui, boolean withTreeView) {
this(hostName, null, paramsFile, null, autorun, noSplash, noGui, withTreeView); this(null, paramsFile, null, autorun, noSplash, noGui, withTreeView);
} }
/** /**
@ -144,21 +141,19 @@ public class Main extends JFrame implements OptimizationStateListener {
* initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()} * initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()}
* to await full initialization if necessary. * to await full initialization if necessary.
* *
* @param hostName
* @param optimizationParameters * @param optimizationParameters
* @param autorun * @param autorun
* @param noSplash * @param noSplash
* @param noGui * @param noGui
* @see #Main(String, String, boolean, boolean) * @see #Main(String, boolean, boolean)
*/ */
public Main(final String hostName, InterfaceOptimizationParameters optimizationParameters, boolean autorun, boolean noSplash, boolean noGui) { public Main(InterfaceOptimizationParameters optimizationParameters, boolean autorun, boolean noSplash, boolean noGui) {
this(hostName, null, null, optimizationParameters, autorun, noSplash, noGui, false); this(null, null, optimizationParameters, autorun, noSplash, noGui, false);
} }
/** /**
* Do not use the tree view by default. * Do not use the tree view by default.
* *
* @param hostName
* @param parent * @param parent
* @param paramsFile * @param paramsFile
* @param goParams * @param goParams
@ -166,8 +161,8 @@ public class Main extends JFrame implements OptimizationStateListener {
* @param noSplash * @param noSplash
* @param noGui * @param noGui
*/ */
public Main(final String hostName, final Window parent, final String paramsFile, final InterfaceOptimizationParameters goParams, final boolean autorun, final boolean noSplash, final boolean noGui) { public Main(final Window parent, final String paramsFile, final InterfaceOptimizationParameters goParams, final boolean autorun, final boolean noSplash, final boolean noGui) {
this(hostName, parent, paramsFile, goParams, autorun, noSplash, noGui, false); this(parent, paramsFile, goParams, autorun, noSplash, noGui, false);
} }
/** /**
@ -179,14 +174,13 @@ public class Main extends JFrame implements OptimizationStateListener {
* multi-threaded for efficiency. Use {@link #awaitClientInitialized()} to * multi-threaded for efficiency. Use {@link #awaitClientInitialized()} to
* await full initialization if necessary. * await full initialization if necessary.
* *
* @param hostName
* @param parent * @param parent
* @param paramsFile * @param paramsFile
* @param autorun * @param autorun
* @param noSplash * @param noSplash
* @param noGui * @param noGui
*/ */
public Main(final String hostName, final Window parent, final String paramsFile, final InterfaceOptimizationParameters goParams, final boolean autorun, final boolean noSplash, final boolean noGui, final boolean showTreeView) { public Main(final Window parent, final String paramsFile, final InterfaceOptimizationParameters goParams, final boolean autorun, final boolean noSplash, final boolean noGui, final boolean showTreeView) {
clientInited = false; clientInited = false;
final eva2.gui.SplashScreen splashScreen = new eva2.gui.SplashScreen(EvAInfo.splashLocation); final eva2.gui.SplashScreen splashScreen = new eva2.gui.SplashScreen(EvAInfo.splashLocation);
@ -213,7 +207,7 @@ public class Main extends JFrame implements OptimizationStateListener {
public void run() { public void run() {
synchronized (this) { synchronized (this) {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
init(hostName, paramsFile, goParams, parent); // this takes a bit init(paramsFile, goParams, parent); // this takes a bit
long wait = System.currentTimeMillis() - startTime; long wait = System.currentTimeMillis() - startTime;
LOGGER.info("Loaded EvA2 in " + wait + "ms."); LOGGER.info("Loaded EvA2 in " + wait + "ms.");
@ -309,10 +303,9 @@ public class Main extends JFrame implements OptimizationStateListener {
} }
/** /**
* Sets given hostname and tries to load GOParamsters from given file if non * Tries to load OptimizationParameters from given file if not null.
* null.
*/ */
private void init(String hostName, String paramsFile, InterfaceOptimizationParameters optimizationParameters, final Window parent) { private void init(String paramsFile, InterfaceOptimizationParameters optimizationParameters, final Window parent) {
useDefaultModule = EvAInfo.propDefaultModule(); useDefaultModule = EvAInfo.propDefaultModule();
this.parentWindow = parent; this.parentWindow = parent;
@ -510,10 +503,10 @@ public class Main extends JFrame implements OptimizationStateListener {
/** /**
* The one and only main of the client program. Possible arguments: * The one and only main of the client program. Possible arguments:
* --autorun immediately starts the optimization (with parameters loaded * --autorun: immediately starts the optimization (with parameters loaded
* from current directory if available. --hostname HOST: sets the hostname * from current directory if available.
* for the Main to HOST --nosplash: skip the splash screen. --params * --nosplash: skip the splash screen.
* PFILE: load the optimization parameter from the serialized file PFILE * --params: PFILE: load the optimization parameter from the serialized file PFILE
* *
* @param args command line parameters * @param args command line parameters
*/ */
@ -583,7 +576,7 @@ public class Main extends JFrame implements OptimizationStateListener {
boolean treeView = (values[5] != null); boolean treeView = (values[5] != null);
String paramsFile = StringTools.checkSingleStringArg(keys[4], values[4], arities[4] - 1); String paramsFile = StringTools.checkSingleStringArg(keys[4], values[4], arities[4] - 1);
new Main("", paramsFile, autorun, nosplash, nogui, treeView); new Main(paramsFile, autorun, nosplash, nogui, treeView);
} }
} }
@ -601,7 +594,7 @@ public class Main extends JFrame implements OptimizationStateListener {
WindowListener windowListener, final Window parent) { WindowListener windowListener, final Window parent) {
Main evaClient; Main evaClient;
evaClient = new Main(null, parent, null, goParams, evaClient = new Main(parent, null, goParams,
false, true, false, false); // initializes GUI in the background false, true, false, false); // initializes GUI in the background
// important: wait for GUI initialization before accessing any internal // important: wait for GUI initialization before accessing any internal
// settings: // settings:
@ -752,7 +745,7 @@ public class Main extends JFrame implements OptimizationStateListener {
* *
* @return * @return
*/ */
public InterfaceOptimizationParameters getGOParameters() { public InterfaceOptimizationParameters getOptimizationParameters() {
if (currentModuleAdapter != null) { if (currentModuleAdapter != null) {
if (currentModuleAdapter instanceof AbstractModuleAdapter) { if (currentModuleAdapter instanceof AbstractModuleAdapter) {
return ((AbstractModuleAdapter) currentModuleAdapter).getOptimizationParameters(); return ((AbstractModuleAdapter) currentModuleAdapter).getOptimizationParameters();
@ -765,7 +758,7 @@ public class Main extends JFrame implements OptimizationStateListener {
return ((GenericModuleAdapter) currentModuleAdapter).getStatistics(); return ((GenericModuleAdapter) currentModuleAdapter).getStatistics();
} }
public InterfaceStatisticsParameter getStatsParams() { public InterfaceStatisticsParameter getStatisticsParameter() {
return ((GenericModuleAdapter) currentModuleAdapter).getStatistics().getStatisticsParameter(); return ((GenericModuleAdapter) currentModuleAdapter).getStatistics().getStatisticsParameter();
} }