Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362697 - UcumEssenceService.getProperties() does not return all the quantitative properties
Summary: UcumEssenceService.getProperties() does not return all the quantitative prope...
Status: RESOLVED FIXED
Alias: None
Product: UOMo
Classification: Technology
Component: UCUM (show other bugs)
Version: 0.6.0   Edit
Hardware: PC All
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Werner Keil CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-02 12:18 EDT by Peter Melnikov CLA
Modified: 2012-10-25 19:20 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Melnikov CLA 2011-11-02 12:18:13 EDT
UcumEssenceService.getProperties() does not return all the physical properties used in definition of units.

Current implementation returns only the properties for DefinedUnit-s:

public Set<String> getProperties() {
   Set<String> result = new HashSet<String>();
   for (DefinedUnit unit : model.getDefinedUnits()) {
       result.add(unit.getProperty());
   }
   return result;
}

but "luminous intensity" is missed in the returned set, because it used in one of BaseUnit-s. Proposed fix for the method:

public Set<String> getProperties() {
   Set<String> result = new HashSet<String>();
   for (DefinedUnit unit : model.getDefinedUnits()) {
       result.add(unit.getProperty());
   }

   for (BaseUnit unit : model.getBaseUnits()) {
       result.add(unit.getProperty());
   }
   return result;
}
Comment 1 Werner Keil CLA 2012-10-25 19:20:09 EDT
Fixed and added unit test asserting the units in getProperties()