HexFiend: HFRangeSet Class Reference

HexFiend

Instance Methods | Class Methods | List of all members
HFRangeSet Class Reference

A set of HFRanges. HFRangeSet takes the interpetation that all zero-length ranges are identical. More...

Inheritance diagram for HFRangeSet:

## Instance Methods
(void) | - addRange:
(void) | - removeRange:
(void) | - clipToRange:
(void) | - toggleRange:
(void) | - addRangeSet:
(void) | - removeRangeSet:
(void) | - clipToRangeSet:
(void) | - toggleRangeSet:
(BOOL) | - isEqualToRangeSet:
(BOOL) | - isEmpty
(BOOL) | - containsAllRange:
(BOOL) | - overlapsAnyRange:
(BOOL) | - containsAllRangeSet:
(BOOL) | - overlapsAnyRangeSet:
(HFRange) | - spanningRange
(void) | - assertIntegrity

## Class Methods
(HFRangeSet *) | + withRange:
(HFRangeSet *) | + withRanges:count:
(HFRangeSet *) | + withRangeWrappers:
(HFRangeSet *) | + withRangeSet:
(HFRangeSet *) | + complementOfRangeSet:inRange:

## Detailed Description

Essentially, a mutable array of ranges that is maintained to be sorted and minimized (i.e. merged with overlapping neighbors).

TODO: The HexFiend codebase currently uses arrays of HFRangeWrappers that have been run through organizeAndMergeRanges:, and not HFRangeSet. The advantage of HFRangeSet is that the sorting & merging is implied by the type, instead of just tacitly assumed. This should lead to less confusion and fewer extra applications of organizeAndMergeRanges.

TODO: HFRangeSet needs to be tested! I guarantee it has bugs! (Which doesn't matter right now because it's all dead code...)

## Method Documentation

## § withRange:()

+ (HFRangeSet *) withRange: |  | (HFRange) | range |

Create a range set with just one range.

## § withRanges:count:()

+ (HFRangeSet *) withRanges: |  | (const HFRange *) | ranges
count: |  | (NSUInteger) | count

Create a range set with a C array of ranges. No prior sorting is necessary.

## § withRangeWrappers:()

+ (HFRangeSet *) withRangeWrappers: |  | (NSArray *) | ranges |

Create a range set with an array of HFRangeWrappers. No prior sorting is necessary.

## § withRangeSet:()

+ (HFRangeSet *) withRangeSet: |  | (HFRangeSet *) | rangeSet |

Create a range set as a copy of another.

## § complementOfRangeSet:inRange:()

+ (HFRangeSet *) complementOfRangeSet: |  | (HFRangeSet *) | rangeSet
inRange: |  | (HFRange) | range

Equivalent to HFRangeSet *x = [HFRangeSet withRange:range]; [x removeRange:rangeSet];

## § addRange:()

- (void) addRange: |  | (HFRange) | range |

Union with range

## § removeRange:()

- (void) removeRange: |  | (HFRange) | range |

Subtract range

## § clipToRange:()

- (void) clipToRange: |  | (HFRange) | range |

Intersect with range

## § toggleRange:()

- (void) toggleRange: |  | (HFRange) | range |

Symmetric difference with range

## § addRangeSet:()

- (void) addRangeSet: |  | (HFRangeSet *) | rangeSet |

Union with range set

## § removeRangeSet:()

- (void) removeRangeSet: |  | (HFRangeSet *) | rangeSet |

Subtract range set

## § clipToRangeSet:()

- (void) clipToRangeSet: |  | (HFRangeSet *) | rangeSet |

Intersect with range set

## § toggleRangeSet:()

- (void) toggleRangeSet: |  | (HFRangeSet *) | rangeSet |

Symmetric difference with range set

## § isEqualToRangeSet:()

- (BOOL) isEqualToRangeSet: |  | (HFRangeSet *) | rangeSet |

Test if two range sets are equivalent.

## § isEmpty()

- (BOOL) isEmpty |  |  |

Test if range set is empty.

## § containsAllRange:()

- (BOOL) containsAllRange: |  | (HFRange) | range |

Check if the range set covers all of a range. Always true if 'range' is zero length.

## § overlapsAnyRange:()

- (BOOL) overlapsAnyRange: |  | (HFRange) | range |

Check if the range set covers any of a range. Never true if 'range' is zero length.

## § containsAllRangeSet:()

- (BOOL) containsAllRangeSet: |  | (HFRangeSet *) | rangeSet |

Check if this range is a superset of another.

## § overlapsAnyRangeSet:()

- (BOOL) overlapsAnyRangeSet: |  | (HFRangeSet *) | rangeSet |

Check if this range has a nonempty intersection with another.

## § spanningRange()

- (HFRange) spanningRange |  |  |

Return a single range that covers the entire range set

## § assertIntegrity()

- (void) assertIntegrity |  |  |

The documentation for this class was generated from the following file:

- HFFunctions.h