-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
method to deal with default values #93
Comments
function like hasRequiredAttributes, hasRequiredElements, setUnsetAttributesToL2v4Default would probably be good to add to help. Original comment by: niko-rodrigue |
All classes should at least offer convenient constructors where all values can be set in one call. There should be multiple constructors so that users can set many combinations of values. Original comment by: draeger |
hasRequiredAttributes? This would mean we have to implement such a static function? Original comment by: draeger |
Ok, I see, we should probably implement * initDefaults(int level, int version) to allow users to set the defaults of some class as specified for the given L/V combination. This method could be called by the initDefaults() method
This makes sense. What about having mutliple constructors? Original comment by: draeger |
I think, supporting just L2V4 like libSBML would be enough. We should not call it from the constructor by default, I think. The advantages of a method like setUnsetAttributesToL2v4Default() is that, on an SBML editor, you can ask the user to fill in the attributes as he like, when he is saving the application developer could decide to call setUnsetAttributesToL2v4Default to complete only the attributes that have not been set. He could also call hasRequiredAttributes and if not ask the user if he want to get back to edit the element or if he just want to have the default values. Original comment by: niko-rodrigue |
I think we did implement the initDefaults(int level, int version) methods but implementing setUnsetAttributesToL2v4Default might be good as well even now. |
Personally, I would not support implementing a method with a prefix "setUnset" which is highly confusing. The |
I think the spirit of the setUnset method from libSBML is to initialize only the values that have not been set directly by the user. Like instead of calling initDefaults on all L3 elements at the start, you can call 'setUnsetXXX' (or whatever name but we might want to keep the libSBML name as well for compatibility) just before writing to be sure to have a valid model. |
And the method hasRequiredAttributes would also be useful. We could, in general, re-review what utility methods libSBML provide to it's users around the default values and see which ones we can implement easily or want to implement. |
Yes, so let's make |
in fact, checking the libsbml java api for Species (http://sbml.org/Software/libSBML/docs/java-api/org/sbml/libsbml/Species.html), it seems that they don't have any more the method setUnsetAttributesToL2v4Default, at least not publicly. And the only methods they have are |
Follow up on the discussions on libsbml-development to know what to do for default values when saving an SBML level 3 model.
Reported by: niko-rodrigue
The text was updated successfully, but these errors were encountered: