← Back to team overview

oship-dev team mailing list archive

[Branch ~oship-dev/oship/devel] Rev 464: Added add, sub and diff methods to IDvAbsoluteQuantity interface. Added magnitudeStatus to DvAbso...

 

------------------------------------------------------------
revno: 464
committer: Wagner Francisco Mezaroba <wagner@wagner-laptop>
branch nick: oship
timestamp: Sun 2010-08-08 16:19:54 -0300
message:
  Added add, sub and diff methods to IDvAbsoluteQuantity interface. Added magnitudeStatus to DvAbsoluteQuantity initializer. Removed accuracyUnknown method in DvQuantified class (it is abstract).
modified:
  src/oship/openehr/rm/datatypes/quantity/__init__.py
  src/oship/openehr/rm/datatypes/quantity/interfaces.py
  src/oship/openehr/rm/datatypes/quantity/tests/dvquantified.py


--
lp:oship
https://code.launchpad.net/~oship-dev/oship/devel

Your team OSHIP Development Team is subscribed to branch lp:oship.
To unsubscribe from this branch go to https://code.launchpad.net/~oship-dev/oship/devel/+edit-subscription
=== modified file 'src/oship/openehr/rm/datatypes/quantity/__init__.py'
--- src/oship/openehr/rm/datatypes/quantity/__init__.py	2010-08-08 19:02:56 +0000
+++ src/oship/openehr/rm/datatypes/quantity/__init__.py	2010-08-08 19:19:54 +0000
@@ -135,9 +135,6 @@
         """
         return val in ['=','>','<','<=','>=','~']
 
-    def accuracyUnknown(self):
-        return self.accuracy is None
-
 
 class DvAbsoluteQuantity(DvQuantified):
     """
@@ -148,9 +145,9 @@
     grok.implements(IDvAbsoluteQuantity)
 
 
-    def __init__(self,magnitude,accuracy,normalRange,otherReferenceRanges,normalStatus):
+    def __init__(self,magnitude,accuracy,normalRange,otherReferenceRanges,normalStatus,magnitudeStatus=None):
         self.accuracy = accuracy
-        DvQuantified.__init__(self,magnitude,accuracy,normalRange,otherReferenceRanges,normalStatus)
+        DvQuantified.__init__(self,magnitude,accuracy,normalRange,otherReferenceRanges,normalStatus,magnitudeStatus)
 
 
     def accuracyUnknown(self):

=== modified file 'src/oship/openehr/rm/datatypes/quantity/interfaces.py'
--- src/oship/openehr/rm/datatypes/quantity/interfaces.py	2010-08-08 19:08:57 +0000
+++ src/oship/openehr/rm/datatypes/quantity/interfaces.py	2010-08-08 19:19:54 +0000
@@ -252,6 +252,29 @@
     def accuracyUnknown():
         """ True if accuracy is None """
 
+    def add(aDiff):
+        """ 
+        Addition of a differential amount to this quantity. 
+        The value of accuracy in the result is either:
+        * the sum of the accuracies of the operands, if both present, or;
+        * unknown, if either or both operand accuracies are unknown.        
+        """
+
+    def subtract(aDiff):
+        """ 
+        Result of subtracting a differential amount from this quantity. 
+        The value of accuracy in the result is either:
+        * the sum of the accuracies of the operands, if both present, or;
+        * unknown, if either or both operand accuracies are unknown.        
+        """
+
+    def diff(other):
+        """ 
+        Difference of two quantities. 
+        The value of accuracy in the result is either:
+        * the sum of the accuracies of the operands, if both present, or;
+        * unknown, if either or both operand accuracies are unknown.
+        """
 
 class IDvCount(Interface):
     """

=== modified file 'src/oship/openehr/rm/datatypes/quantity/tests/dvquantified.py'
--- src/oship/openehr/rm/datatypes/quantity/tests/dvquantified.py	2010-08-08 19:02:56 +0000
+++ src/oship/openehr/rm/datatypes/quantity/tests/dvquantified.py	2010-08-08 19:19:54 +0000
@@ -39,11 +39,5 @@
         dvQuantified = SimpleDvQuantified(None,None,None,None,None,None)
         self.assertEquals(None, dvQuantified.magnitudeStatus)
 
-    def testAccuracyUnknown(self):
-        dvQuantified = SimpleDvQuantified(None,None,None,None,None,None)
-        self.assertEquals(True, dvQuantified.accuracyUnknown())
-        dvQuantified.accuracy = 1
-        self.assertEquals(False, dvQuantified.accuracyUnknown())
-
 class SimpleDvQuantified(DvQuantified):
     pass