# RepetitionRegion

## Abstract

class for a repetition region.

## Discussion

a repetition region is a region in a string build of a fundamental substring s two or more times in intermediate succession.

## Methods

`-completeString`
  returns the repetition region's complete string representation.
`-containsIntersectingRangeFrom:`
  returns YES if the repetition region contains another repetition region in two consecutive substrings. eg: 1000110001 contains 11 intersecting.
`-containsRangeFrom:`
  returns YES if the repetition region's range contains the range from another region.
`-fundamentalSubstring`
  returns the fundamental substring.
`-fundamentalSubstringContainsRangeFrom:`
  returns YES if the repetition region's fundamental substring contains the range from another region.
`-initWithFundamentalSubstring:fromIndex:withLength:`
  initialises a repetition region with a fundamental substring from an index with a length.
`-initWithFundamentalSubstring:inRange:`
  initialises a repetition region with a fundamental substring in a certain range.
`-length`
  returns the repetition region's complete length.
`-overlappedByRangeFrom:`
  returns YES if the repetition region is overlapped by antoher region.
`-printToLog`
  prints the repetition to NSLog().
`-range`
  returns range the repetition region is in.
`-repetitionRegionStartingInLastRepetition:`
  returns YES if another repetition region satrts in the last repetition of the fundamental substring.
`-repetitions`
  returns nuber of repetitions of the fundamental substring.
`-splitIntersectingRepetitionRegion:`
  splits another intersecting repetition region in the intersecting point.
`-splitOnIndex:`
  splits repetition region index.
`-startLocation`
  returns the location of the first repetition.
`-trunkateWith:`
  trunkates repetition region based on an overlapping other region. eg in ab11ab(1111), (1111 trunkateWith: ab11) = 11 (depending on locations)

### completeString

returns the repetition region's complete string representation.

>     - (NSString *)completeString;

### containsIntersectingRangeFrom:

returns YES if the repetition region contains another repetition region in two consecutive substrings. eg: 1000110001 contains 11 intersecting.

>     - (BOOL)containsIntersectingRangeFrom:(RepetitionRegion *)aRepetitionRegion;

### containsRangeFrom:

returns YES if the repetition region's range contains the range from another region.

>     - (BOOL)containsRangeFrom:(RepetitionRegion *)aRepetitionRegion;

### fundamentalSubstring

returns the fundamental substring.

>     - (NSString *)fundamentalSubstring;

### fundamentalSubstringContainsRangeFrom:

returns YES if the repetition region's fundamental substring contains the range from another region.

>     - (BOOL)fundamentalSubstringContainsRangeFrom:(RepetitionRegion *)aRepetitionRegion;

### initWithFundamentalSubstring:fromIndex:withLength:

initialises a repetition region with a fundamental substring from an index with a length.

>     - (id)initWithFundamentalSubstring:(NSString *)aFundamentalSubstring
>             fromIndex:(int)rangeStart withLength:(int)rangeLength;

### initWithFundamentalSubstring:inRange:

initialises a repetition region with a fundamental substring in a certain range.

>     - (id)initWithFundamentalSubstring:(NSString *)aFundamentalSubstring
>             inRange:(NSRange)aRange;

### length

returns the repetition region's complete length.

>     - (int)length;

### overlappedByRangeFrom:

returns YES if the repetition region is overlapped by antoher region.

>     - (BOOL)overlappedByRangeFrom:(RepetitionRegion *)aRepetitionRegion;

### printToLog

prints the repetition to NSLog().

>     - (void)printToLog;

### range

returns range the repetition region is in.

>     - (NSRange)range;

### repetitionRegionStartingInLastRepetition:

returns YES if another repetition region satrts in the last repetition of the fundamental substring.

>     - (BOOL)repetitionRegionStartingInLastRepetition:(RepetitionRegion *)aRepetitionRegion;

### repetitions

returns nuber of repetitions of the fundamental substring.

>     - (int)repetitions;

### splitIntersectingRepetitionRegion:

splits another intersecting repetition region in the intersecting point.

>     - (NSArray *)splitIntersectingRepetitionRegion:(RepetitionRegion *)aRepetitionRegion;

method result
  splitted regions in an NSArray if splitting is possible, nil if not.

### splitOnIndex:

splits repetition region index.

>     - (NSArray *)splitOnIndex:(int)index;

method result
  splitted regions in an NSArray if splitting is possible, nil if not.

### startLocation

returns the location of the first repetition.

>     - (int)startLocation;

### trunkateWith:

trunkates repetition region based on an overlapping other region. eg in ab11ab(1111), (1111 trunkateWith: ab11) = 11 (depending on locations)

>     - (BOOL)trunkateWith:(RepetitionRegion *)aRepetitionRegion;

method result
  YES if the repetition region was trunated by the overlapping piece of another regioin, NO if trunkation was not possible.

(Last Updated M/D/Y)