Oolite 1.91.0.7604-240417-a536cbe
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
OOPriorityQueue.m File Reference
#include <assert.h>
import "OOPriorityQueue.h"
import "OOFunctionAttributes.h"
+ Include dependency graph for OOPriorityQueue.m:

Go to the source code of this file.

Classes

category  OOPriorityQueue(Private)
 
class  OOPriorityQueueEnumerator
 

Typedefs

typedef NSComparisonResult(* CompareIMP) (id self, SEL _cmd, id other)
 

Enumerations

enum  { kMinCapacity = 16 }
 

Functions

OOINLINE NSUInteger PQLeftChild (NSUInteger n) INLINE_CONST_FUNC
 
OOINLINE NSUInteger PQRightChild (NSUInteger n) INLINE_CONST_FUNC
 
OOINLINE NSUInteger PQParent (NSUInteger n) INLINE_CONST_FUNC
 
OOINLINE NSComparisonResult PQCompare (id a, id b, SEL comparator)
 

Typedef Documentation

◆ CompareIMP

typedef NSComparisonResult(* CompareIMP) (id self, SEL _cmd, id other)

Definition at line 89 of file OOPriorityQueue.m.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kMinCapacity 

Definition at line 48 of file OOPriorityQueue.m.

49{
50 kMinCapacity = 16
51};
@ kMinCapacity

Function Documentation

◆ PQCompare()

OOINLINE NSComparisonResult PQCompare ( id a,
id b,
SEL comparator )

Definition at line 92 of file OOPriorityQueue.m.

93{
94 CompareIMP compare = NULL;
95 NSComparisonResult result;
96
97 // This is equivalent to [a performSelector:comparator withObject:b], except the resulting value isn't an object.
98 compare = (CompareIMP)[a methodForSelector:comparator];
99 result = compare(a, comparator, b);
100 return result;
101}
NSComparisonResult(* CompareIMP)(id self, SEL _cmd, id other)

◆ PQLeftChild()

OOINLINE NSUInteger PQLeftChild ( NSUInteger n)

Definition at line 72 of file OOPriorityQueue.m.

73{
74 return (n << 1) + 1;
75}

◆ PQParent()

OOINLINE NSUInteger PQParent ( NSUInteger n)

Definition at line 83 of file OOPriorityQueue.m.

84{
85 return ((n + 1) >> 1) - 1;
86}

◆ PQRightChild()

OOINLINE NSUInteger PQRightChild ( NSUInteger n)

Definition at line 77 of file OOPriorityQueue.m.

78{
79 return (n << 1) + 2;
80}