ObjectiveLib
1.0.0
|
A category for implementing the OLArithmetic protocol using the NSNumber class from the Cocoa Foundation library. More...
#import <ObjectiveLib/Arithmetic.h>
Public Member Functions | |
(id) | - arithmeticAdd: |
Add the value of a given object to this object's value. | |
(id) | - arithmeticDivideBy: |
Divide this object's value by the value of another object. | |
(id) | - arithmeticModulus: |
Compute the remainder of division by the value of a given object. | |
(id) | - arithmeticMultiply: |
Multiply this object's value by the value of a given one. | |
(id) | - arithmeticNegate |
Negate the value of this object. | |
(id) | - arithmeticSubtract: |
Subtract the value of a given object from this object's value. |
A category for implementing the OLArithmetic protocol using the NSNumber class from the Cocoa Foundation library.
All objects used by these methods should be forms of NSNumber, or the operations will not work as expected.
- (id) arithmeticAdd: | (id) | value |
Add the value of a given object to this object's value.
The two values are added together and a new object containing the result is returned. The result is the same as using operator +
in Standard C.
value | the value to add |
- (id) arithmeticDivideBy: | (id) | value |
Divide this object's value by the value of another object.
The result of the division is returned in a newly created object. The result is the same as using operator /
in Standard C.
value | the value by which to divide |
- (id) arithmeticModulus: | (id) | value |
Compute the remainder of division by the value of a given object.
The result is returned in a newly created object. The result is the same as using operator %
in Standard C.
value | the value by which to divide |
- (id) arithmeticMultiply: | (id) | value |
Multiply this object's value by the value of a given one.
The result of the multiplication is returned in a newly created object. The result is the same as using operator *
in Standard C.
value | the value by which to multiply |
- (id) arithmeticNegate |
Negate the value of this object.
The negated value is returned in a newly created object. The result is the same as using the unary operator -
in Standard C.
- (id) arithmeticSubtract: | (id) | value |
Subtract the value of a given object from this object's value.
The given value is subtracted and a new object containing the result is returned. The result is the same as using binary operator -
in Standard C.
value | the value to subtract |
|