Bugs item #3488145, was opened at 2012-02-16 01:43
Message generated for change (Tracker Item Submitted) made by cpudney
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=744692&aid=3488145&group_id=139835

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Chris Pudney (cpudney)
Assigned to: Nobody/Anonymous (nobody)
Summary: MultiChoiceParameter serialization can't distinguish unset

Initial Comment:
When a MultiChoiceParameter is serialized there is no way to distinguish the 
parameter being unset from being set to empty (no choices selected).

Why is this a problem?

Suppose config.xml holds a MultiChoiceParameter that holds some selections, e.g.

                <parameter name="Adducts">
                    <item>[M+Na-H] 21.982 m/z</item>
                    <item>[M+NH3] 17.026 m/z</item>
                    <item>[M+H3PO4] 97.977 m/z</item>
                    <item>[(Deuterium)]glycerol 5.000 m/z</item>
                </parameter>

Then suppose you open a project with the parameter serialized thus:

                <parameter name="Adducts" />

This will be interpreted to mean that the Adducts parameter should be set to 
having zero selections.

However, the same serialization can arise (and is more likely) if the project 
configuration did not set the Adducts parameter.

There needs to be some way of distinguishing unset parameters (that don't 
overwrite the parameter value) from those that indicate a null/empty/zero value.

Some parameters do something like this (DoubleParameter):

        final String numString = xmlElement.getTextContent();
        if (numString.length() > 0) {

            value = Double.parseDouble(numString);
        }

i.e. only set value if the parameter's XML element has content.

However, this probably wont work for MultiChoiceParameter.  A similar issue 
arises for StringParameter.  How to distinguish between unset (don't set value) 
and empty string (do set value).

One possibility is if the following:

if the module XML block contains a block for a specific parameter then always 
set the parameter's value.  If the block's content is empty then set the value 
to empty/null/zero.

If the module block doesn't contain a block for a specific parameter then don't 
set the parameter's value.  This represents an unset parameter.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=744692&aid=3488145&group_id=139835

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Mzmine-devel mailing list
Mzmine-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mzmine-devel

Reply via email to