1 //
2 //  KTMatrixSparseEnumerator and KTMutableMatrixSparseEnumerator
3 //  KTMatrix collection class cluster
4 //
5 //  Enumerator classes for the sparse implementations of KTMatrix
6 //
7 //  Copyright (c) 2002 Chris Purcell. All rights reserved.
8 //
9 //  You may use this code for whatever purposes you wish.
10 //  This code comes with no warranties, implied or otherwise.
11 //  Using it may damage your data. It shouldn't, but save a copy first.
12 //  That's a good idea anyway, actually.
13 //
14 
15 #import <Foundation/Foundation.h>
16 #import "KTMatrix.h"
17 
18 struct KTMatrixSparseElement
19 {
20     unsigned hashedLocation;
21     id object;
22 } ;
23 
24 
25 @interface KTMatrixSparseEnumerator : NSEnumerator<KTMatrixEnumerator>
26 {
27     const struct KTMatrixSparseElement *array;
28     BOOL broken;
29     unsigned count;
30     unsigned offset;
31     id source;
32 }
33 
34 - (id)initWithArray:(const struct KTMatrixSparseElement *)array
35               count:(unsigned)count
36          collection:(id)collection;
37 
38 @end
39 
40 
41 @interface KTMutableMatrixSparseEnumerator : NSEnumerator<KTMatrixEnumerator>
42 {
43     NSHashEnumerator data;
44     struct KTMatrixSparseElement *lastLocation;
45     id source;
46 }
47 
48 - (id)initWithHashEnumerator:(NSHashEnumerator)enumerator
49                   collection:(id)collection;
50 
51 @end
52