1 //
2 //  KTMutableMatrixSparseImp
3 //  KTMatrix collection class cluster
4 //
5 //  KTMatrix class cluster mutable implementation subclass
6 //  Uses hash tables to reference on-the-fly allocated memory
7 //  Ideal for sparsely-populated matrices
8 //  Sacrifices some speed for a considerable potential memory saving
9 //  Sacrifices some of those memory savings for mutability
10 //  Same object retrieval time as any hash table-based storage
11 //
12 //  Copyright (c) 2002 Chris Purcell. All rights reserved.
13 //
14 //  You may use this code for whatever purposes you wish.
15 //  This code comes with no warranties, implied or otherwise.
16 //  Using it may damage your data. It shouldn't, but save a copy first.
17 //  That's a good idea anyway, actually.
18 //
19 
20 #import <Foundation/Foundation.h>
21 #import "KTMutableMatrix.h"
22 
23 @interface KTMutableMatrixSparseImp : KTMutableMatrix
24 {
25     NSHashTable *matrix;
26     id<KTLocationHash> hash;
27     BOOL hashIsCoordinateOptimized;
28     void *cache;
29 }
30 
31 - (id)initWithMatrixData:(NSDictionary *)matrixData
32             locationHash:(id<KTLocationHash>)locationHash;
33 - (id)initWithLocationHash:(id<KTLocationHash>)locationHash
34                     object:(id)object
35           atHashedLocation:(unsigned)loc;
36 
37 - (void)   setObject:(id)object
38     atHashedLocation:(unsigned)loc;
39 
40 @end
41