brackets-manager
Version:
A simple library to manage tournament brackets (round-robin, single elimination, double elimination)
273 lines • 10.6 kB
TypeScript
import { DeepPartial, Storage } from '../types';
import { Group, Match, MatchGame, Round, SeedOrdering, Stage, StageType, GroupType, Id } from 'brackets-model';
import { RoundPositionalInfo } from '../types';
import { StageCreator } from './stage/creator';
export declare class BaseGetter {
protected readonly storage: Storage;
/**
* Creates an instance of a Storage getter.
*
* @param storage The implementation of Storage.
*/
constructor(storage: Storage);
/**
* Gets all the rounds that contain ordered participants.
*
* @param stage The stage to get rounds from.
*/
protected getOrderedRounds(stage: Stage): Promise<Round[]>;
/**
* Gets all the rounds that contain ordered participants in a single elimination stage.
*
* @param stageId ID of the stage.
*/
private getOrderedRoundsSingleElimination;
/**
* Gets all the rounds that contain ordered participants in a double elimination stage.
*
* @param stageId ID of the stage.
*/
private getOrderedRoundsDoubleElimination;
/**
* Gets the positional information (number in group and total number of rounds in group) of a round based on its id.
*
* @param roundId ID of the round.
*/
protected getRoundPositionalInfo(roundId: Id): Promise<RoundPositionalInfo>;
/**
* Gets the matches leading to the given match.
*
* @param match The current match.
* @param matchLocation Location of the current match.
* @param stage The parent stage.
* @param roundNumber Number of the round.
*/
protected getPreviousMatches(match: Match, matchLocation: GroupType, stage: Stage, roundNumber: number): Promise<Match[]>;
/**
* Gets the matches leading to the given match, which is in a final group (consolation final or grand final).
*
* @param match The current match.
* @param stage The parent stage.
* @param roundNumber Number of the current round.
*/
private getPreviousMatchesFinal;
/**
* Gets the matches leading to the given match, which is in a final group (consolation final).
*
* @param match The current match.
* @param stage The parent stage.
*/
private getPreviousMatchesFinalSingleElimination;
/**
* Gets the matches leading to the given match, which is in a final group (grand final).
*
* @param match The current match.
* @param stage The parent stage.
* @param roundNumber Number of the current round.
*/
private getPreviousMatchesFinalDoubleElimination;
/**
* Gets the matches leading to a given match from the loser bracket.
*
* @param match The current match.
* @param stage The parent stage.
* @param roundNumber Number of the round.
*/
private getPreviousMatchesLB;
/**
* Gets the matches leading to a given match in a major round (every round of upper bracket or specific ones in lower bracket).
*
* @param match The current match.
* @param roundNumber Number of the round.
*/
private getMatchesBeforeMajorRound;
/**
* Gets the matches leading to a given match in the first round of the loser bracket.
*
* @param match The current match.
* @param winnerBracketId ID of the winner bracket.
* @param roundNumberWB The number of the previous round in the winner bracket.
*/
private getMatchesBeforeFirstRoundLB;
/**
* Gets the matches leading to a given match in a minor round of the loser bracket.
*
* @param match The current match.
* @param winnerBracketId ID of the winner bracket.
* @param roundNumber Number of the current round.
* @param roundNumberWB The number of the previous round in the winner bracket.
*/
private getMatchesBeforeMinorRoundLB;
/**
* Gets the match(es) where the opponents of the current match will go just after.
*
* @param match The current match.
* @param matchLocation Location of the current match.
* @param stage The parent stage.
* @param roundNumber The number of the current round.
* @param roundCount Count of rounds.
*/
protected getNextMatches(match: Match, matchLocation: GroupType, stage: Stage, roundNumber: number, roundCount: number): Promise<(Match | null)[]>;
/**
* Gets the match(es) where the opponents of the current match of winner bracket will go just after.
*
* @param match The current match.
* @param stage The parent stage.
* @param roundNumber The number of the current round.
* @param roundCount Count of rounds.
*/
private getNextMatchesWB;
/**
* Gets the match(es) where the opponents of the current match of an upper bracket will go just after.
*
* @param match The current match.
* @param stage The parent stage.
* @param roundNumber The number of the current round.
* @param roundCount Count of rounds.
*/
private getNextMatchesUpperBracket;
/**
* Gets the match(es) where the opponents of the current match of the unique bracket of a single elimination will go just after.
*
* @param match The current match.
* @param stageType Type of the stage.
* @param roundNumber The number of the current round.
* @param roundCount Count of rounds.
*/
private getNextMatchesUpperBracketSingleElimination;
/**
* Gets the match(es) where the opponents of the current match of the unique bracket of a double elimination will go just after.
*
* @param match The current match.
* @param stageType Type of the stage.
* @param roundNumber The number of the current round.
* @param roundCount Count of rounds.
*/
private getNextMatchesUpperBracketDoubleElimination;
/**
* Gets the match(es) where the opponents of the current match of loser bracket will go just after.
*
* @param match The current match.
* @param stage The parent stage.
* @param roundNumber The number of the current round.
* @param roundCount Count of rounds.
*/
private getNextMatchesLB;
/**
* Gets the first match of the final group (consolation final or grand final).
*
* @param finalGroupId ID of the final group.
*/
private getFinalGroupFirstMatch;
/**
* Gets the consolation final in a double elimination tournament.
*
* @param finalGroupId ID of the final group.
*/
private getConsolationFinalMatchDoubleElimination;
/**
* Gets the match following the current match, which is in the final group (consolation final or grand final).
*
* @param match The current match.
* @param stage The parent stage.
* @param roundNumber The number of the current round.
* @param roundCount The count of rounds.
*/
private getNextMatchesFinal;
/**
* Gets the match where the opponents of the current match of a winner bracket's major round will go just after.
*
* @param match The current match.
* @param roundNumber The number of the current round.
*/
private getMatchAfterMajorRoundLB;
/**
* Gets the match where the opponents of the current match of a winner bracket's minor round will go just after.
*
* @param match The current match.
* @param roundNumber The number of the current round.
*/
private getMatchAfterMinorRoundLB;
/**
* Returns the good seeding ordering based on the stage's type.
*
* @param stageType The type of the stage.
* @param create A reference to a Create instance.
*/
protected static getSeedingOrdering(stageType: StageType, create: StageCreator): SeedOrdering;
/**
* Returns the matches which contain the seeding of a stage based on its type.
*
* @param stageId ID of the stage.
* @param stageType The type of the stage.
*/
protected getSeedingMatches(stageId: Id, stageType: StageType): Promise<Match[] | null>;
/**
* Gets the first round of the upper bracket.
*
* @param stageId ID of the stage.
*/
private getUpperBracketFirstRound;
/**
* Gets the last round of a group.
*
* @param groupId ID of the group.
*/
private getLastRound;
/**
* Returns the id of the final group (containing consolation final, or grand final, or both).
*
* @param stageId ID of the stage.
* @param stageType Type of the stage.
*/
private getFinalGroupId;
/**
* Gets the upper bracket (the only bracket if single elimination or the winner bracket in double elimination).
*
* @param stageId ID of the stage.
*/
protected getUpperBracket(stageId: Id): Promise<Group>;
/**
* Gets the loser bracket.
*
* @param stageId ID of the stage.
*/
protected getLoserBracket(stageId: Id): Promise<Group | null>;
/**
* Gets the corresponding match in the next round ("diagonal match") the usual way.
*
* Just like from Round 1 to Round 2 in a single elimination stage.
*
* @param groupId ID of the group.
* @param roundNumber Number of the round in its parent group.
* @param matchNumber Number of the match in its parent round.
*/
private getDiagonalMatch;
/**
* Gets the corresponding match in the next round ("parallel match") the "major round to minor round" way.
*
* Just like from Round 1 to Round 2 in the loser bracket of a double elimination stage.
*
* @param groupId ID of the group.
* @param roundNumber Number of the round in its parent group.
* @param matchNumber Number of the match in its parent round.
*/
private getParallelMatch;
/**
* Finds a match in a given group. The match must have the given number in a round of which the number in group is given.
*
* **Example:** In group of id 1, give me the 4th match in the 3rd round.
*
* @param groupId ID of the group.
* @param roundNumber Number of the round in its parent group.
* @param matchNumber Number of the match in its parent round.
*/
protected findMatch(groupId: Id, roundNumber: number, matchNumber: number): Promise<Match>;
/**
* Finds a match game based on its `id` or based on the combination of its `parent_id` and `number`.
*
* @param game Values to change in a match game.
*/
protected findMatchGame(game: DeepPartial<MatchGame>): Promise<MatchGame>;
}
//# sourceMappingURL=getter.d.ts.map