Package adams.run

Class RunScheme

    • Field Detail

      • m_OptionManager

        protected OptionManager m_OptionManager
        for managing the available options.
    • Constructor Detail

      • RunScheme

        public RunScheme()
        default constructor.
    • Method Detail

      • initialize

        protected void initialize()
        initializes member variables.
      • newOptionManager

        protected OptionManager newOptionManager()
        Returns a new instance of the option manager.
        Returns:
        the manager to use
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options. Derived classes must override this method to add additional options.
        Specified by:
        defineOptions in interface OptionHandler
      • destroy

        public void destroy()
        Frees up memory in a "destructive" non-reversible way.

        Cleans up the options.
        Specified by:
        destroy in interface Destroyable
        See Also:
        cleanUpOptions()
      • preRun

        protected void preRun()
                       throws Exception
        Performs some initializations before the actual run. Default implementation does nothing.
        Throws:
        Exception - if something goes wrong
      • doRun

        protected abstract void doRun()
                               throws Exception
        Performs the actual run.
        Throws:
        Exception - if something goes wrong
      • postRun

        protected void postRun()
                        throws Exception
        Performs some output/cleanup after the actual run. Default implementation does nothing.
        Throws:
        Exception - if something goes wrong
      • run

        public void run()
                 throws Exception
        Runs the scheme and prints some information to stdout.
        Throws:
        Exception - if something goes wrong
      • toCommandLine

        public String toCommandLine()
        Returns the commandline string.
        Specified by:
        toCommandLine in interface OptionHandler
        Returns:
        the commandline
      • forName

        public static RunScheme forName​(String classname,
                                        String[] options)
        Instantiates the run scheme with the given options.
        Parameters:
        classname - the classname of the run scheme to instantiate
        options - the options for the run scheme
        Returns:
        the instantiated run scheme or null if an error occurred
      • forCommandLine

        public static RunScheme forCommandLine​(String cmdline)
        Instantiates the run scheme from the given commandline (i.e., classname and optional options).
        Parameters:
        cmdline - the classname (and optional options) of the run scheme to instantiate
        Returns:
        the instantiated run scheme or null if an error occurred
      • runScheme

        public static void runScheme​(Class env,
                                     Class scheme,
                                     String[] args)
        Runs the tool from commandline.
        Parameters:
        env - the environment class to use
        scheme - the scheme to execute
        args - the commandline arguments, use -help to display all