Decimal floating point number exception and rounding behavior. This class is mutable. More...
#import <CPDecimalNumberHandler.h>
Class Methods | |
(id) | + decimalNumberHandlerWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero: |
(id) | + defaultDecimalNumberHandler |
Class Methods inherited from CPObject | |
(BOOL) | + accessInstanceVariablesDirectly |
(id) | + alloc |
(id) | + allocWithCoder: |
(BOOL) | + automaticallyNotifiesObserversForKey: |
(void) | + cancelPreviousPerformRequestsWithTarget: |
(void) | + cancelPreviousPerformRequestsWithTarget:selector:object: |
(Class) | + class |
(BOOL) | + conformsToProtocol: |
(void) | + exposeBinding: |
(void) | + initialize |
(IMP) | + instanceMethodForSelector: |
(BOOL) | + instancesImplementSelector: |
(BOOL) | + instancesRespondToSelector: |
(BOOL) | + isBindingExclusive: |
(BOOL) | + isSubclassOfClass: |
(CPSet) | + keyPathsForValuesAffectingValueForKey: |
(void) | + load |
(id) | + new |
(void) | + object:performSelector:withObject:afterDelay:inModes: |
(void) | + setVersion: |
(Class) | + superclass |
(int) | + version |
Decimal floating point number exception and rounding behavior. This class is mutable.
Definition at line 32 of file CPDecimalNumber.j.
|
implementation |
Create a new CPDecimalNumberHandler object with the parameters specified. This class handles the behaviour of the decimal number calculation engine on certain exception. For more details see -initWithRoundingMode
:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:
Definition at line 101 of file CPDecimalNumber.j.
|
implementation |
Return the default Cappuccino CPDecimalNumberHandler object instance.
Definition at line 117 of file CPDecimalNumber.j.
|
implementation |
Called by CPCoder's encodeObject: to archive the object instance.
aCoder | a CPCoder instance |
Provided by category CPDecimalNumberHandler(CPCoding).
Definition at line 255 of file CPDecimalNumber.j.
|
implementation |
This method is invoked by the framework when an exception occurs on a decimal operation. Depending on the specified behaviour of the CPDecimalNumberHandler this will throw exceptions accordingly with formatted error messages.
operation | the selector of the method of the operation being performed when the exception occurred |
error | the actual error type. From the CPCalculationError enum: CPCalculationNoError, CPCalculationLossOfPrecision, CPCalculationOverflow, CPCalculationUnderflow, CPCalculationDivideByZero |
leftOperand | the CPDecimalNumber left-hand side operand used in the calculation that caused the exception |
rightOperand | the CPDecimalNumber right-hand side operand used in the calculation that caused the exception |
Provided by category CPDecimalNumberHandler(CPDecimalNumberBehaviors).
Definition at line 180 of file CPDecimalNumber.j.
|
implementation |
Initialise a CPDecimalNumberHandler with 'Rounding' = CPRoundPlain, 'Scale' = 0 and 'Raise On [exactness, overflow, underflow, divide by zero]' = [no, yes, yes, yes].
Reimplemented from CPObject.
Definition at line 49 of file CPDecimalNumber.j.
|
implementation |
Called by CPCoder's decodeObject: to initialise the object with an archived one.
aCoder | a CPCoder instance |
Provided by category CPDecimalNumberHandler(CPCoding).
Definition at line 236 of file CPDecimalNumber.j.
|
implementation |
Initialise a CPDecimalNumberHandler object with the parameters specified. This class handles the behaviour of the decimal number calculation engine on certain exceptions.
roundingMode | the technique used for rounding (see CPRoundingMode) |
scale | The number of digits after the decimal point that a number which is rounded should have |
exact | If true, a change in precision (i.e. rounding) will cause a CPDecimalNumberExactnessException exception to be raised, else they are ignored |
overflow | If true, a calculation overflow will cause a CPDecimalNumberOverflowException exception to be raised, else the maximum possible valid number is returned |
underflow | If true, a calculation underflow will cause a CPDecimalNumberUnderflowException exception to be raised, else the minimum possible valid number is returned |
divideByZero | If true, a divide by zero will cause a CPDecimalNumberDivideByZeroException exception to be raised, else a NotANumber (NaN) CPDecimal is returned |
Definition at line 80 of file CPDecimalNumber.j.
|
implementation |
Returns the current rounding mode. One of CPRoundingMode enum: CPRoundPlain, CPRoundDown, CPRoundUp, CPRoundBankers.
Provided by category CPDecimalNumberHandler(CPDecimalNumberBehaviors).
Definition at line 148 of file CPDecimalNumber.j.
|
implementation |
Returns the number of digits allowed after the decimal point.
Provided by category CPDecimalNumberHandler(CPDecimalNumberBehaviors).
Definition at line 157 of file CPDecimalNumber.j.