1 // 2 // KTMatrixDenseImp 3 // KTMatrix collection class cluster 4 // 5 // KTMatrix class cluster mutable implementation subclass 6 // Constant-time access to a mass-allocated chunk of memory 7 // Ideal for mostly-populated matrices 8 // Pointer arithmetic accounts for the speed 9 // 10 // Copyright (c) 2002 Chris Purcell. All rights reserved. 11 // 12 // You may use this code for whatever purposes you wish. 13 // This code comes with no warranties, implied or otherwise. 14 // Using it may damage your data. It shouldn't, but save a copy first. 15 // That's a good idea anyway, actually. 16 // 17 18 #import <Foundation/Foundation.h> 19 #import "KTMutableMatrix.h" 20 21 @interface KTMutableMatrixDenseImp : KTMutableMatrix 22 { 23 id<KTLocationHash> hash; 24 BOOL hashIsCoordinateOptimized; 25 unsigned count; 26 unsigned capacity; 27 id *array; 28 } 29 30 - (id)initWithMatrixData:(NSDictionary *)matrixData 31 locationHash:(id<KTLocationHash>)locationHash; 32 - (id)initWithLocationHash:(id<KTLocationHash>)locationHash 33 object:(id)object 34 atHashedLocation:(unsigned)loc; 35 36 - (void) setObject:(id)object 37 atHashedLocation:(unsigned)loc; 38 39 @end 40