Options
All
  • Public
  • Public/Protected
  • All
Menu

Helper class for the [[Adjective]] module. Stores endings of words and what to do with them.

Hierarchy

  • Ending

Index

Constructors

constructor

  • Constructor for the Ending class.

    Parameters

    • string: string

      The string that represents the ending.

    • customFunction: CustomFunctionType

      Function that specifies the changes that will happen to the string.

    Returns Ending

  • Constructor for the Ending class.

    Parameters

    • string: string

      The string that represents the ending.

    • sliceDepth: number

      The number of characters that will be sliced off the string before the adjective conversion.

    • newEnding: string

      the ending that will be appended to the string after the slicing.

    • Optional customFunction: CustomFunctionType

      Function that specifies the changes that will happen to the string.

    Returns Ending

Properties

customFunction

customFunction: CustomFunctionType | undefined

A function that determines how a word is transformed when turned into an adjective.

newEnding

newEnding: string | undefined

The new characters added to turn the word into an adjective.

sliceDepth

sliceDepth: number | undefined

The negative of the amount of characters that are removed at the end.

string

string: string

The pattern at the end of a word.

Methods

changeEnding

  • changeEnding(name: string, gender: Gender): string
  • Applies the ending to a string, doing the necessary modifications.

    Parameters

    • name: string

      The string to modify.

    • gender: Gender

      The grammatical gender used to build the adjective.

    Returns string

    The name, modified into an adjective.

Static Private compare

  • compare(name: string, endingStr: string, k: number): number

Static findEnding

  • Helper function for BaseLanguage.toAdjective. Finds the ending that fits a string among a list of endings. Uses a modified binary search.

    Parameters

    • name: string

      The string for which we want to match an ending.

    • endings: Ending[]

      The sorted list of endings that name will be compared to.

    Returns Ending | null

    The first ending that matches, or null if none does.

Generated using TypeDoc, the 1/31/2021 at 6:18:55 AM