Re: Units inheritance in Level 3
20 Mar '12 04:56
>> 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?
Dr. Andreas Dräger
University of Tuebingen
Center for Bioinformatics Tuebingen (ZBIT)
To manage your jsbml-development list subscription, visit
For a web interface to the jsbml-development mailing list, visit
For questions or feedback about the jsbml-development list,
Powered by FUDforum. (Copyright Advanced Internet Designs Inc.)