This section describes the purpose of the methods you override and what you should do with them
This is the first method that is called after the user has selected this algorithm and has pressed the 'Start' button to commence it. The purpose of this method is to enable you, the developer, to present an options panel to the user where he can set up some values used by your algorithm if you want him to.
The rest of the application blocks unless you return the thread from this method.
If you want to provide a GUI (a Graphical User Interface), then your algorithm should assemble and display your options at this point, using Swing components for that. You can create your own dialog frame to display your panel or you can use MembraneAlgorithmGUI. popUpGUI() (see Essential Methods and Objects) for that.
The boolean that you have to return from this method indicates whether or not your membrane algorithm should proceed or if it should be cancelled already:
Return true if the user confirmed his settings or if you don't provide a GUI at all.
Return false not to start the algorithm e.g. if the user chose to cancel it.
This method is the entry point of your algorithm. All further operations are invoked here. As soon as this method returns, the algorithm is finished and will terminate.
There is no general pattern for how you have implement your algorithm inside this method. But here's a good proposal of how it could be done:
Write a loop that performs the following steps:
Alternatively, you could pick an existing lipid and just change its alignment (only if you do not want to add new ones), or you could mix up both approaches.
Use this method to return a String that contains a full description
of your algorithm. This is the text that gets displayed in the large text
area that the user sees when he selects an algorithm.
Make sure to insert line breaks for a proper style.
May return "null" if you want.
This method returns the name that you want use for this algorithm.
It gets displayed in the table.
The
name also serves as an identifier, that's why it has to be unique and not
empty to get this algorithm to be accepted
Here you can return a description that is a than the complete
information. It will be written into the output file later on if the membrane
has been generated with this algorithm.
May also return "null".
Allows you to return a String that is meant to contain the setup parameters
of your algorithm GUI. This String will also be written into the output file
later on. It is up to you how you style this String and what contents you
put into it.
May return "null".
Enables you to provide a panel that contains options that can be accessed
during the runtime of the algorithm. It will be placed beneath the 3D view,
so try to keep it small.
This method may also return "null" if there is no need for a panel.
This method is called when the user presses the 'Stop' button while the algorithm is running. It is up to you to recognize this call and to terminate the algorithm at the next appropriate point.
It
is very important to handle this case, otherwise the user will not have the
opportunity to abort the algorithm.
The easiest way to handle this is to use a flag that gets toggled inside this method. The algorithm then uses this flag for each loop to decide whether to break or to continue.
Here you have to decide if your algorithm needs to remove all existing lipids first or if they may remain. If you return true, then all lipids will be automatically removed before this algorithm starts, if you return false, they will be remained.
Forces you to provide information as to whether your algorithm supports microdomains or not. Return false if you don't want or need to implement microdomain support. This value will be presented in the table of available algorithms.