forked from LIJI32/SameBoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HFAnnotatedTree.h
57 lines (42 loc) · 1.19 KB
/
HFAnnotatedTree.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// HFAnnotatedTree.h
// HexFiend_2
//
// Copyright 2010 ridiculous_fish. All rights reserved.
//
#import <Foundation/NSObject.h>
typedef unsigned long long (*HFAnnotatedTreeAnnotaterFunction_t)(id left, id right);
@interface HFAnnotatedTreeNode : NSObject <NSMutableCopying> {
HFAnnotatedTreeNode *left;
HFAnnotatedTreeNode *right;
HFAnnotatedTreeNode *parent;
uint32_t level;
@public
unsigned long long annotation;
}
/* Pure virtual method, which must be overridden. */
- (NSComparisonResult)compare:(HFAnnotatedTreeNode *)node;
/* Returns the next in-order node. */
- (id)nextNode;
- (id)leftNode;
- (id)rightNode;
- (id)parentNode;
#if ! NDEBUG
- (void)verifyIntegrity;
- (void)verifyAnnotation:(HFAnnotatedTreeAnnotaterFunction_t)annotater;
#endif
@end
@interface HFAnnotatedTree : NSObject <NSMutableCopying> {
HFAnnotatedTreeAnnotaterFunction_t annotater;
HFAnnotatedTreeNode *root;
}
- (instancetype)initWithAnnotater:(HFAnnotatedTreeAnnotaterFunction_t)annotater;
- (void)insertNode:(HFAnnotatedTreeNode *)node;
- (void)removeNode:(HFAnnotatedTreeNode *)node;
- (id)rootNode;
- (id)firstNode;
- (BOOL)isEmpty;
#if ! NDEBUG
- (void)verifyIntegrity;
#endif
@end