@sahabaplus/mushaf-engine
Version:
TypeScript implementation of a Quran Mushaf navigation engine
104 lines (103 loc) • 4.53 kB
TypeScript
import { Verse } from '../mushaf/verse';
import { LastVerseResult } from './lastVerseResult';
import { OverflowResult } from './overflowResult';
/**
* Comprehensive result of a navigation operation in the Quran
*
* This class contains the primary verse reached through navigation,
* as well as optional information about any overflow conditions or boundary
* verses (last verse of page or sura) encountered during navigation.
*/
export declare class NavigationResult {
/**
* The verse reached through navigation
*/
verse: Verse;
/**
* Optional information about overflow if navigation exceeded boundaries
*/
overflow?: OverflowResult;
/**
* Optional information about the last verse of the page if encountered during navigation
*/
endOfPage?: LastVerseResult;
/**
* Optional information about the last verse of the sura if encountered during navigation
*/
endOfSura?: LastVerseResult;
/**
* The actual distance moved during navigation in lines
*/
distanceMoved: number;
/**
* The remaining distance that could not be navigated due to boundaries
*/
remainingDistance: number;
/**
* Create a new NavigationResult with all possible parameters
*
* @param verse - The verse reached through navigation
* @param overflow - Optional information about overflow if navigation exceeded boundaries
* @param endOfPage - Optional information about the last verse of the page if encountered
* @param endOfSura - Optional information about the last verse of the sura if encountered
* @param distanceMoved - The actual distance moved during navigation in lines
*/
constructor(verse: Verse, overflow?: OverflowResult, endOfPage?: LastVerseResult, endOfSura?: LastVerseResult, distanceMoved?: number);
/**
* Create a new NavigationResult for a normal navigation with no boundary conditions
*
* @param verse - The verse reached through navigation
* @param distanceMoved - The actual distance moved during navigation in lines
* @returns A new NavigationResult instance with only the target verse and no boundary information
*/
static newNormal(verse: Verse, distanceMoved: number): NavigationResult;
/**
* Create a new NavigationResult for a navigation that includes overflow
*
* @param verse - The verse reached through navigation
* @param overflow - Information about overflow during navigation
* @param distanceMoved - The actual distance moved during navigation in lines
* @returns A new NavigationResult instance with the target verse and overflow information
*/
static newOverflowed(verse: Verse, overflow: OverflowResult, distanceMoved: number): NavigationResult;
/**
* Create a new NavigationResult that reached the last verse of a page
*
* @param verse - The verse reached through navigation
* @param lastOfPage - Information about the last verse of the page
* @param distanceMoved - The actual distance moved during navigation in lines
* @returns A new NavigationResult instance with the target verse and last-of-page information
*/
static newPageBoundary(verse: Verse, lastOfPage: LastVerseResult, distanceMoved: number): NavigationResult;
/**
* Create a new NavigationResult that reached the last verse of a sura
*
* @param verse - The verse reached through navigation
* @param lastOfSura - Information about the last verse of the sura
* @param distanceMoved - The actual distance moved during navigation in lines
* @returns A new NavigationResult instance with the target verse and last-of-sura information
*/
static newSuraBoundary(verse: Verse, lastOfSura: LastVerseResult, distanceMoved: number): NavigationResult;
/**
* Check if this navigation result encountered any boundaries
*
* @returns true if the navigation hit the last verse of page, sura, or had an overflow
*/
hasBoundaries(): boolean;
/**
* Check if this navigation result encountered an overflow condition
*
* @returns true if the navigation exceeded available boundaries
*/
hasOverflow(): boolean;
/**
* Get the total overflow lines if any exist
*
* @returns The number of overflow lines, or 0.0 if no overflow occurred
*/
overflowLines(): number;
/**
* Create a string representation of the navigation result
*/
toString(): string;
}