/* StorageAdditions.m
 * Written By:  Thomas Burkholder
 *
 * You may freely copy, distribute, and reuse the code in this example.
 * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
 * fitness for any particular use.
 */

#import "StorageAdditions.h"
#define NX_NOT_IN_STORAGE -1

@implementation Storage (StorageAdditions)

- (unsigned int)indexOf:(void *)anElement
{
	int i;

	for(i=0;(i<numElements);i++) {
		if (*(long *)anElement == *(long *)[self elementAt:i])
			return i;
	}
	return NX_NOT_IN_STORAGE;
}

- addElementIfAbsent:(void *)anElement
{
	if (NX_NOT_IN_STORAGE == [self indexOf:anElement])
		[self addElement:anElement];
	return self;
}

@end
