#import <ObjectiveLib/Map.h>
Inheritance diagram for OLMultiMap:
Public Member Functions | |
(void) | - assignKey:value: |
Assign a value to a key. | |
(id) | - insert: |
Insert a key-value pair into the map. | |
(OLAssociativeIterator *) | - insertAt:value: |
Insert a key-value pair into the map. | |
(void) | - insertFrom:to: |
Insert a range of key-value pairs into the map. | |
(BOOL) | - isEqual: |
Test whether another map is equal to this one. | |
(id) | - valueForKey: |
Find the value of a given key. | |
Static Public Member Functions | |
(id) | + multiMap |
Create and return a new map. | |
(id) | + multiMapFrom:to: |
Create and return a new map. | |
(id) | + multiMapWithCompare: |
Create and return a new map. | |
(id) | + multiMapWithMap: |
Create and return a new map. |
Multimap is identical to map expect that as many instances of any given key may be inserted as desired.
- (void) assignKey: | (id) | key | ||
value: | (id) | value | ||
Assign a value to a key.
This message always inserts the key-value pair (key, value)
.
key | the key to insert | |
value | the key's value |
Reimplemented from OLMap.
- (id) insert: | (OLPair *) | keyValue |
Insert a key-value pair into the map.
The pair is inserted and an instance of OLAssociativeIterator is returned indicating the position of keyValue in the set. The object to which the iterator points is an instance of OLPair. The first element of the pair is the key and the second element of the pair is the key's value.
keyValue | the element to insert |
Reimplemented from OLMap.
- (OLAssociativeIterator*) insertAt: | (OLAssociativeIterator *) | where | ||
value: | (OLPair *) | keyVal | ||
Insert a key-value pair into the map.
The keyVal is inserted and the position indicated by where is used as a hint about where in the map the keyVal should be placed. There is no guarantee that the keyVal will ultimately placed anywhere close to where. Note that the insertion may fail if the key is already in the map. An iterator is returned that points to object. The object to which the iterator points is an instance of OLPair. The first element of the pair is the key and the second element of the pair is the key's value.
where | a hint as to where in the map the keyVal should be located | |
keyVal | the key-value pair to insert |
Reimplemented from OLMap.
- (void) insertFrom: | (OLForwardIterator *) | first | ||
to: | (OLForwardIterator *) | last | ||
Insert a range of key-value pairs into the map.
An attempt is made to insert all pairs in the range [first, last)
, however there is no guarantee that any of the elements in the range will actually be inserted if they already exist in the map.
[first, last)
must be instances of OLPair where the first element of the pair is the key and the second element is the key's value.first | the first in the range of pairs to insert | |
last | one position beyond the last in the range of pairs to insert |
Reimplemented from OLMap.
- (BOOL) isEqual: | (id) | object |
Test whether another map is equal to this one.
Two maps are considered equal if they contain the same number of objects and the and the value of each key is equal to the value of the corresponding key in the other map.
object | the object to test |
Reimplemented from OLMap.
+ (id) multiMap |
Create and return a new map.
An instance of OLLess is used to compare keys for sorting.
+ (id) multiMapFrom: | (OLForwardIterator *) | first | ||
to: | (OLForwardIterator *) | last | ||
Create and return a new map.
The map is initialized with the contents of the range [first, last)
. An instance of OLLess is used to compare keys for sorting.
[first, last)
must be an instance of OLPair. The first element of the pair is the key and the second element is the key's value.first | the first in the range of elements to insert | |
last | one beyond the last in the range of elements to insert |
+ (id) multiMapWithCompare: | (OLStreamableFunctor< OLBoolBinaryFunction > *) | comp |
Create and return a new map.
The map is empty and the comparison function comp is used to sort keys.
comp | the comparison function used to sort keys |
+ (id) multiMapWithMap: | (OLMap *) | right |
Create and return a new map.
The map is initialized with the contents of right.
If OpenStep is present the returned object will be autoreleased before being returned.
right | the map to copy |
- (id) valueForKey: | (id) | key |
Find the value of a given key.
Since a multimap can have any number of values associated with equivilent keys, this message does nothing. The value nil
is always returned.
key | the key for which to search |
nil
Reimplemented from OLMap.
|