Hi Chris,
In the new design it is not necessary for the module to clone the parameter
set, because MZmine will clone it automatically after the user clicks the OK
button of the parameter setup dialog.
I mentioned this in the MZmineProcessingModule comments ("The ParameterSet has
already been cloned for exclusive use by this module, therefore the module does
not need to clone it again."):
/**
* Run this module with given parameters. The module may create new Tasks
* and add them to the 'tasks' collection. The module is not supposed to
* submit the tasks to the TaskController by itself.
*
* @param parameters
* ParameterSet to invoke this module with. The ParameterSet has
* already been cloned for exclusive use by this module,
* therefore the module does not need to clone it again. Upon
* invocation of the runModule() method it is guaranteed that the
* ParameterSet is of the proper class as returned by
* getParameterSetClass(). Also, it is guaranteed that the
* ParameterSet is checked by checkParameters(), therefore the
* module does not need to perform these checks again.
* @param tasks
* A collection where the module should add its newly created
* Tasks, if it creates any.
* @return Exit code of the operation. ExitCode.OK means the module was
* started properly, however it does not guarantee that the Tasks
* will finish without error. ExitCode.ERROR means there was a
* problem starting the module.
*/
@Nonnull
public ExitCode runModule(@Nonnull ParameterSet parameters,
@Nonnull Collection<Task> tasks);
=> If you still see some new FooTask(..., parameters.clone()); in the code, it
is a relic and can be removed.
Cheers,
Tomas
On Feb 2, 2012, at 1:40 PM, Pudney Chris (ext) GBJH wrote:
> G'day,
>
> This is a great improvement.
>
> A related question. I often see code like the following
>
> new FooTask(..., parameters.clone());
>
> It shouldn't be necessary to clone the parameter set should it?
>
> In fact, I think it's up to FooTask to decide how it deals with the
> ParameterSet it is passed. Many take copies of individual parameter values
> in the constructor for later use in their run() methods. Others copy the
> ParameterSet in their constructor and then get the parameter values as
> they're needed.
>
> It's the latter case where the Task should clone() the ParameterSet isn't it
> (in case during execution of the Task the user modifies the global instance
> of the module's ParameterSet).
>
> Regards,
> Chris.
>
> -----
> Hi all,
>
> I found an annoying bug in MZmine (up to last version 2.5). If you create a
> batch with two steps of the same mass detector (e.g. Centroid), then the
> instance of the parameter set of this mass detector is shared for both steps
> and it is not possible to set different parameters to them. This bug was
> probably caused by a general confusion in how many instances of ParameterSet
> should exist: the MZmineModule interface had a getParameterSet() method, but
> the runModule() method had another ParameterSet as its parameter. To make the
> story short, I decided to fix this by changing the MZmineModule interface and
> took this as an opportunity to cleanup some old code.
>
> The MZmineModule interface now defines the modules's parameter class using
> this method:
>
> public Class<? extends ParameterSet> getParameterSetClass();
>
> There is a new interface MZmineConfiguration that stores the global (main)
> parameter set for each module.
> During startup, one instance of each module's parameter set is created and
> stored in the configuration class.
>
> I moved the code for loading/saving configuration to the configuration class,
> so the MZmineCore class is now a bit shorter.
>
> Additionally, I created a new interface MZmineProcessingStep, which
> represents a pair of a module and its parameter set.
> For example, this is used for each step of the batch mode processing.
>
> Please update your sources from the trunk and let me know if have any
> questions/problems.
>
> Cheers,
>
> Tomas
>
>
> This message may contain confidential information. If you are not the
> designated recipient, please notify the sender immediately, and delete the
> original and any copies. Any use of the message by you is prohibited.
>
>
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Mzmine-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mzmine-devel
>
===============================================
Tomas Pluskal
G0 Cell Unit, Okinawa Institute of Science and Technology Graduate University
1919-1 Tancha, Onna-son, Okinawa 904-0495, Japan
TEL: +81-98-966-8684
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Mzmine-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mzmine-devel