Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 362697

Summary: UcumEssenceService.getProperties() does not return all the quantitative properties
Product: [Technology] UOMo Reporter: Peter Melnikov <peter.melnikov>
Component: UCUMAssignee: Werner Keil <werner.keil>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3    
Version: 0.6.0   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

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()