MeasurementValue.st
changeset 18832 885cfb29ed7c
parent 16274 598ee861547a
child 18858 2968df243134
child 21929 1b3b40b8b16c
equal deleted inserted replaced
18831:86e8f2bd201b 18832:885cfb29ed7c
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 2007 by eXept Software AG
     4  COPYRIGHT (c) 2007 by eXept Software AG
     3               All Rights Reserved
     5               All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
     8  be provided or otherwise made available to, or used by, any
    10  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
    11  other person.  No title to or ownership of the software is
    10  hereby transferred.
    12  hereby transferred.
    11 "
    13 "
    12 "{ Package: 'stx:libbasic' }"
    14 "{ Package: 'stx:libbasic' }"
       
    15 
       
    16 "{ NameSpace: Smalltalk }"
    13 
    17 
    14 Number subclass:#MeasurementValue
    18 Number subclass:#MeasurementValue
    15 	instanceVariableNames:'value minValue maxValue'
    19 	instanceVariableNames:'value minValue maxValue'
    16 	classVariableNames:'MeasurementValueZero'
    20 	classVariableNames:'MeasurementValueZero'
    17 	poolDictionaries:''
    21 	poolDictionaries:''
   236 
   240 
   237     "Modified (comment): / 14-02-2012 / 14:17:39 / cg"
   241     "Modified (comment): / 14-02-2012 / 14:17:39 / cg"
   238 !
   242 !
   239 
   243 
   240 coerce:aNumber
   244 coerce:aNumber
   241     "convert the argument aNumber into an instance of the receivers class and return it."
   245     "convert the argument aNumber into an instance of the receiver's class and return it."
   242 
   246 
   243     ^ MeasurementValue value:aNumber minValue:aNumber maxValue:aNumber
   247     ^ MeasurementValue value:aNumber minValue:aNumber maxValue:aNumber
   244 !
   248 !
   245 
   249 
   246 generality
   250 generality
   247     "return the generality value - see ArithmeticValue>>retry:coercing:"
   251     "return the generality value - see ArithmeticValue>>retry:coercing:"
   248 
   252 
   249     "/ adding 1 to the values generality has the subtle side effect of enforcing 
   253     "/ adding 1 to the value's generality has the subtle side effect of enforcing 
   250     "/ a call to coerce: for mixed type operations (i.e. Int * MeasurementValue).
   254     "/ a call to coerce: for mixed type operations (i.e. Int * MeasurementValue).
   251     "/ try it.
   255     "/ try it.
   252 
   256 
   253     ^ value generality + 1 
   257     ^ value generality + 1 
   254 ! !
   258 ! !
   382 ! !
   386 ! !
   383 
   387 
   384 !MeasurementValue class methodsFor:'documentation'!
   388 !MeasurementValue class methodsFor:'documentation'!
   385 
   389 
   386 version
   390 version
   387     ^ '$Header: /cvs/stx/stx/libbasic/MeasurementValue.st,v 1.13 2014-03-24 11:14:37 stefan Exp $'
   391     ^ '$Header$'
   388 ! !
   392 ! !
   389 
   393