685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
|
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
|
-
+
-
+
-
+
-
+
-
+
|
- (void)dealloc
{
[_mapTable release];
[super dealloc];
}
- (void *)nextObject
- (void **)nextObject
{
OF_UNRECOGNIZED_SELECTOR
}
- (void)reset
{
if (*_mutationsPtr != _mutations)
@throw [OFEnumerationMutationException
exceptionWithObject: _mapTable];
_position = 0;
}
@end
@implementation OFMapTableKeyEnumerator
- (void *)nextObject
- (void **)nextObject
{
if (*_mutationsPtr != _mutations)
@throw [OFEnumerationMutationException
exceptionWithObject: _mapTable];
for (; _position < _capacity && (_buckets[_position] == NULL ||
_buckets[_position] == &deleted); _position++);
if (_position < _capacity)
return _buckets[_position++]->key;
return &_buckets[_position++]->key;
else
return NULL;
}
@end
@implementation OFMapTableObjectEnumerator
- (void *)nextObject
- (void **)nextObject
{
if (*_mutationsPtr != _mutations)
@throw [OFEnumerationMutationException
exceptionWithObject: _mapTable];
for (; _position < _capacity && (_buckets[_position] == NULL ||
_buckets[_position] == &deleted); _position++);
if (_position < _capacity)
return _buckets[_position++]->object;
return &_buckets[_position++]->object;
else
return NULL;
}
@end
@implementation OFMapTable_EnumeratorWrapper
- initWithEnumerator: (OFMapTableEnumerator *)enumerator
|
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
|
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
|
-
+
-
+
+
+
+
-
+
|
[_object release];
[super dealloc];
}
- (id)nextObject
{
id ret;
void **objectPtr;
@try {
ret = [_enumerator nextObject];
objectPtr = [_enumerator nextObject];
if (objectPtr == NULL)
return nil;
} @catch (OFEnumerationMutationException *e) {
@throw [OFEnumerationMutationException
exceptionWithObject: _object];
}
return ret;
return (id)*objectPtr;
}
- (void)reset
{
@try {
[_enumerator reset];
} @catch (OFEnumerationMutationException *e) {
@throw [OFEnumerationMutationException
exceptionWithObject: _object];
}
}
@end
|