$darkmode
DENOPTIM
denoptim.main.Main Class Reference

Entry point of any kind of run of the DENOPTIM program. More...

Classes

enum  RunType
 Types of runs that can be requested to the DENOPTIM Main class. More...
 

Static Public Member Functions

static void main (String[] args)
 Launches the appropriate program according to the arguments given. More...
 

Static Protected Member Functions

static Behavior defineProgramBehavior (String[] args)
 Does the processing of the application arguments and decides what the program should do. More...
 

Static Private Member Functions

static void runProgramTask (Class<?> taskClass, File inputFile, File workDir)
 Creates a task for the given class. More...
 
static Behavior ensureFileExistsAndIsReadable (File file, Behavior behavior)
 Checks the file exists and format is recognized. More...
 
static String getHelpString ()
 Prints the help message on a string. More...
 
static void reportError (String msg, int exitCode)
 Prints an error message on standard output and then stops the Virtual Machine with an exit code. More...
 
static void reportError (Behavior behavior)
 Prints an error message on standard output, possibly after the help message, and then stops the Virtual Machine with an exit code. More...
 
static void terminate ()
 Stops services and halts the Virtual Machine. More...
 

Detailed Description

Entry point of any kind of run of the DENOPTIM program.

Definition at line 57 of file Main.java.

Member Function Documentation

◆ defineProgramBehavior()

static Behavior denoptim.main.Main.defineProgramBehavior ( String[]  args)
staticprotected

Does the processing of the application arguments and decides what the program should do.

Note that this method already checks if the pathname given for the CLIOptions#input option is valid.

Parameters
argsthe arguments to process
Returns
the behavior of the program as inferred from the given arguments.

Definition at line 439 of file Main.java.

References denoptim.main.Main.RunType.DRY, denoptim.main.Main.ensureFileExistsAndIsReadable(), denoptim.main.Main.getHelpString(), denoptim.main.CLIOptions.getInstance(), denoptim.main.Main.RunType.GUI, denoptim.main.CLIOptions.help, denoptim.main.Main.RunType.isCLIEnabled, denoptim.main.Main.reportError(), denoptim.main.CLIOptions.run, denoptim.logging.Version.VERSION, and denoptim.main.CLIOptions.version.

Referenced by denoptim.main.Main.main(), and denoptim.main.MainTest.testDefineProgramBehavior().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ensureFileExistsAndIsReadable()

static Behavior denoptim.main.Main.ensureFileExistsAndIsReadable ( File  file,
Behavior  behavior 
)
staticprivate

Checks the file exists and format is recognized.

Parameters
filefile to check.
behaviorthis is where we write error messages.

Definition at line 406 of file Main.java.

References denoptim.main.Behavior.cmd, denoptim.files.FileUtils.detectFileFormat(), denoptim.main.Behavior.runType, and denoptim.files.FileFormat.UNRECOGNIZED.

Referenced by denoptim.main.Main.defineProgramBehavior().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHelpString()

static String denoptim.main.Main.getHelpString ( )
staticprivate

Prints the help message on a string.

Returns
the string ready to be printed.

Definition at line 513 of file Main.java.

References denoptim.constants.DENOPTIMConstants.EOL, and denoptim.main.CLIOptions.getInstance().

Referenced by denoptim.main.Main.defineProgramBehavior().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

static void denoptim.main.Main.main ( String[]  args)
static

◆ reportError() [1/2]

static void denoptim.main.Main.reportError ( Behavior  behavior)
staticprivate

Prints an error message on standard output, possibly after the help message, and then stops the Virtual Machine with an exit code.

Definition at line 552 of file Main.java.

References denoptim.main.Behavior.errorMsg, denoptim.main.Behavior.exitStatus, denoptim.main.Behavior.helpMsg, and denoptim.main.Main.reportError().

Here is the call graph for this function:

◆ reportError() [2/2]

static void denoptim.main.Main.reportError ( String  msg,
int  exitCode 
)
staticprivate

Prints an error message on standard output and then stops the Virtual Machine with an exit code.

Parameters
msgthe message explaining the type of error. This string will be printed after "ERROR! ".
exitCodethe exit code for the virtual machine.

Definition at line 538 of file Main.java.

References denoptim.constants.DENOPTIMConstants.EOL.

Referenced by denoptim.main.Main.defineProgramBehavior(), denoptim.main.Main.main(), denoptim.main.Main.reportError(), and denoptim.main.Main.runProgramTask().

Here is the caller graph for this function:

◆ runProgramTask()

static void denoptim.main.Main.runProgramTask ( Class<?>  taskClass,
File  inputFile,
File  workDir 
)
staticprivate

Creates a task for the given class.

Parameters
taskClass
inputFile
workDir
Exceptions
SecurityException
NoSuchMethodException

Definition at line 362 of file Main.java.

References denoptim.constants.DENOPTIMConstants.EOL, denoptim.exception.ExceptionUtils.getStackTraceAsString(), denoptim.main.Main.reportError(), and denoptim.task.StaticTaskManager.submitAndWait().

Referenced by denoptim.main.Main.main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ terminate()

static void denoptim.main.Main.terminate ( )
staticprivate

Stops services and halts the Virtual Machine.

Definition at line 564 of file Main.java.

References denoptim.task.StaticTaskManager.stopAll().

Referenced by denoptim.main.Main.main().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: