#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. | |
The primary use of this protocol is with function objects that perform arithmetic, like OLPlus. All the messages in this protocol perform an arithmetic operation on a passed-in argument, allocate a new object for the result of the operation and return it.
| - (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 should be 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 should be 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 should be 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 should be 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 should be 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 should be the same as using binary operator - in Standard C.
| value | the value to subtract |
|