43 const Set *
this = (
Set *) self;
57 for (
size_t i = 0; i < this->capacity; i++) {
81 const Set *
this = (
Set *) self;
85 for (
size_t i = 0; i < this->capacity; i++) {
86 if (this->elements[i]) {
105 const Set *
this = (
Set *) self;
106 const Set *that = (
Set *) other;
108 if (this->count == that->
count) {
112 for (
size_t i = 0; i < objects->
count; i++) {
148 return (
Array *) objects;
157 if (self->capacity) {
177 for (
size_t i = 0; i < self->capacity; i++) {
201 for (
size_t i = 0; i < self->capacity; i++) {
223 for (
size_t i = 0; i < self->capacity; i++) {
274 va_start(args, self);
326 for (
size_t i = 0; i < self->capacity; i++) {
366 for (
size_t i = 0; i < self->capacity; i++) {
372 accumulator = reducer(
array->elements[j], accumulator,
data);
421#pragma mark - Class lifecycle
462 .instanceSize =
sizeof(
Set),
463 .interfaceOffset = offsetof(
Set, interface),
464 .interfaceSize =
sizeof(SetInterface),
ident release(ident obj)
Atomically decrement the given Object's reference count. If the resulting reference count is 0,...
Class * _initialize(const ClassDef *def)
Initializes the given Class.
#define alloc(type)
Allocate and initialize and instance of type.
#define super(type, obj, method,...)
int HashForInteger(int hash, const long integer)
Accumulates the hash value of integer into hash.
int HashForObject(int hash, const ident obj)
Accumulates the hash value of object into hash.
Utilities for calculating hash values.
#define HASH_SEED
The hash seed value.
static void initWithArray_enumerator(const Array *array, ident obj, ident data)
ArrayEnumerator for initWithArray.
static void allObjects_enumerator(const Set *set, ident obj, ident data)
SetEnumerator for allObjects.
static void initialize(Class *clazz)
static void initWithSet_enumerator(const Set *set, ident obj, ident data)
SetEnumerator for initWithSet.
void(* SetEnumerator)(const Set *set, ident obj, ident data)
A function pointer for Set enumeration (iteration).
void * ident
The identity type, similar to Objective-C id.
_Bool(* Predicate)(const ident obj, ident data)
The Predicate function type for filtering Objects.
ident(* Functor)(const ident obj, ident data)
The Functor function type for transforming Objects.
ident(* Reducer)(const ident obj, ident accumulator, ident data)
The Reducer function type for reducing collections.
#define do_once(once, block)
Executes the given block at most one time.
Array * initWithObjects(Array *self,...)
Initializes this Array to contain the Objects in the NULL-terminated arguments list.
ident reduce(const Array *self, Reducer reducer, ident accumulator, ident data)
MutableArray * mutableCopy(const Array *self)
void enumerateObjects(const Array *self, ArrayEnumerator enumerator, ident data)
Enumerate the elements of this Array with the given function.
Array * initWithArray(Array *self, const Array *array)
Initializes this Array to contain the Objects in array.
ident objectAtIndex(const Array *self, int index)
_Bool containsObject(const Array *self, const ident obj)
size_t count
The count of elements.
ClassDefs are passed to _initialize via an archetype to initialize a Class.
The runtime representation of a Class.
ident interface
The interface of the Class.
Condition * init(Condition *self)
Initializes this Condition.
Array * allObjects(const Dictionary *self)
void addObject(MutableArray *self, const ident obj)
Adds the specified Object to this MutableArray.
MutableArray * array(void)
Returns a new MutableArray.
MutableArray * initWithCapacity(MutableArray *self, size_t capacity)
Initializes this MutableArray with the specified capacity.
MutableData * data(void)
Returns a new MutableData.
void addObjectsFromSet(MutableSet *self, const Set *set)
Adds the Objects contained in set to this Set.
MutableSet * set(void)
Returns a new MutableSet.
Object is the root Class of The Objectively Class hierarchy.
Class * clazz
Every instance of Object begins with a pointer to its Class.
Class * _Object(void)
The Object archetype.
Object * copy(const Object *self)
Creates a shallow copy of this Object.
String * description(const Object *self)
_Bool isEqual(const Object *self, const Object *other)
Tests equality of the other Object.
int hash(const Object *self)
void dealloc(Object *self)
Frees all resources held by this Object.
Set * setWithSet(const Set *set)
Returns a new Set with the contents of set.
size_t count
The count of elements.
Set * initWithObjects(Set *self,...)
Initializes this Set with the specified objects.
Set * mappedSet(const Set *self, Functor functor, ident data)
Transforms the elements in this Set by functor.
Set * initWithArray(Set *self, const Array *array)
Initializes this Set to contain the Objects in array.
Set * initWithSet(Set *self, const Set *set)
Initializes this Set to contain the Objects in set.
MutableSet * mutableCopy(const Set *self)
Set * setWithObjects(ident obj,...)
Returns a new Set containing the specified Objects.
Set * filteredSet(const Set *self, Predicate predicate, ident data)
Creates a new Set with elements that pass predicate.
Class * _Set(void)
The Set archetype.
_Bool containsObjectMatching(const Set *self, Predicate predicate, ident data)
Set * setWithArray(const Array *array)
Returns a new Set with the contents of array.