| Author | Topic |
Posts: 273
Registered: June 2006
|
|
Re: Units inheritance in Level 3
|
20 Mar '12 04:56

|
 |
|
Hi Sarah,
>> Yes. That's what I would like to do. It is actually very easy using a
>> filter for listOf<UnitDefinition> that accepts the first identical
>> UnitDefinition (using a call like
>> UnitDefinition.areIdentical(myJustDerivedUnit, unitNumberXXfromTheList),
>> with XX being the counter in the for-each loop).
>
> My main thought about this is to consider what the user might want to
> do with the unitDefinition returned from getDerivedUnits(). They may
> wish to change or use it somewhere else and may not actually want it
> to be part of the original model.
>
In deed, there are two different ways to go.
1. The user always receives a newly created UnitDefinition and can
manipulate it in any way, but if it is necessary to ensure that the unit
is already part of the model, the user must add it by him/herself.
Similarly, the user would have to filter the Model's list of units for
an identical unit by him/herself.
2. The user gets a unit that may already belong to the model. A check
can be done by asking myModel.getListOfUnits().contains(myUnit). If it
is already in the model and the user wants to do some change, a call to
the clone() method might be necessary.
It now depends on what the users would prefer to have. Maybe you're
right, and way #2 is less streightforward because the user does not know
if the unit belongs to the model or not. In idea #1 the returned unit
never belongs to the model.
Are there any other opinions on that topic?
Cheers
Andreas
--
Dr. Andreas Dräger
University of Tuebingen
Center for Bioinformatics Tuebingen (ZBIT)
Sand 1
72076 Tübingen
Germany
Phone: +49-7071-29-78982
Fax: +49-7071-29-5091
____________________________________________________________
To manage your jsbml-development list subscription, visit
https://utils.its.caltech.edu/mailman/listinfo/jsbml-development
For a web interface to the jsbml-development mailing list, visit
http://sbml.org/Forums/
For questions or feedback about the jsbml-development list,
contact sbml-team@caltech.edu
|
|
|