Comments (11)
function like hasRequiredAttributes, hasRequiredElements, setUnsetAttributesToL2v4Default would probably be good to add to help.
Original comment by: niko-rodrigue
from jsbml.
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
from jsbml.
hasRequiredAttributes? This would mean we have to implement such a static function?
Original comment by: draeger
from jsbml.
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
- the check if all required attributes have been set, i.e. hasRequiredAttributes/Elements().
This makes sense. What about having mutliple constructors?
Original comment by: draeger
from jsbml.
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
from jsbml.
I think we did implement the initDefaults(int level, int version) methods but implementing setUnsetAttributesToL2v4Default might be good as well even now.
from jsbml.
Personally, I would not support implementing a method with a prefix "setUnset" which is highly confusing. The initDefaults(int level, int version)
should make clear what is meant. We should highlight this better in the documentation.
from jsbml.
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.
Also at the moment, the initDefaults method are not public on the SBase interface so you cannot call them easily, we have a pivotal tracker item about that (https://www.pivotaltracker.com/story/show/121664987).
from jsbml.
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.
from jsbml.
Yes, so let's make initDefaults(int level, int version)
public on SBase
as suggested and also add this hasAllRequiredAttributes
method, but not setUnset
which sounds to me like "do undo" or "yes no" and also instead of having just one method with level and version as attributes we would have to implement n such specific methods for each Level/Version combination, which cannot be in our interest.
from jsbml.
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 initDefaults()
and hasRequiredAttributes()
so that make it easier.
from jsbml.
Related Issues (20)
- The test if a plugin is loaded returns true when JSBML has a parser loaded HOT 6
- suggestion for all libraries: implement a logging facade instead of the logger HOT 5
- Exceptions thrown depending on the log level HOT 4
- order of authors is not correct HOT 1
- Stable version link in Readme.md file is not correct
- Spatial: nearestneighbor should be nearestNeighbor HOT 1
- no update on maven HOT 13
- java.lang.NoClassDefFoundError: org/apache/logging/log4j/util/ReflectionUtil HOT 3
- Issue when parsing math formula HOT 9
- Error reading file
- Make offline validation the default
- Deriving a unit for a lambda expression may cause an out of bounds exception
- Unary operator precedence ignored by ASTNode parser. HOT 6
- Removing objectives from a model is not sensitive for removal of the active objective
- Improve flattening by testing and merging an existing fork HOT 1
- Cloning of GeneProduct may create invalid SBML because of missing required attribute `label`
- Add checks if a model element already exists before adding it to avoid clashes in ModelBuilder
- No property change happens when a value is explicitly set to NaN that was undefined before
- NullPointerException in ASTNode
- Found the bug in ASTNode.toFomula() HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsbml.