File: HFAnnotatedTree.h

package info (click to toggle)
sameboy 1.0.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 10,632 kB
  • sloc: ansic: 29,954; objc: 22,249; asm: 1,424; pascal: 1,373; makefile: 1,064; xml: 111
file content (57 lines) | stat: -rw-r--r-- 1,217 bytes parent folder | download | duplicates (2)
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