Class StringSet

A set of words.

Words are stored as a sorted list of canonicalized words. The actual value of the set is wordSets.

Hierarchy

  • StringSet

Properties

empty: StringSet = ...

Accessors

  • get hasEmptyWord(): boolean
  • true if this set contains the empty word.

    Returns boolean

  • get hasSingleCharacter(): boolean
  • true if this set contains at least one single-character word.

    This is equivalent to this.getSingleCharacter() !== undefined.

    Returns boolean

  • get isEmpty(): boolean
  • true if this set is empty.

    Returns boolean

  • get wordSets(): readonly ReadonlyWordSet[]
  • The words of this set with toCharSet applied to each character.

    Word sets are guaranteed to be sorted by ascending length.

    Note: This is a lazy getter. Try to avoid calling it for best performance.

    Returns readonly ReadonlyWordSet[]

Methods

  • Returns whether this set is equal to the given set.

    Equality is defined as the wordSets of both sets being the same formal language.

    Parameters

    Returns boolean

  • Returns the minimum and maximum length of words in this set.

    If this set is empty, undefined will be returned returned.

    Returns undefined | {
        max: number;
        min: number;
    }

  • Returns a set of all single-character words in this set or undefined if this set contains no single-character words.

    Returns undefined | CharSet

  • Returns the intersection of this set and the given set.

    Note: This operation is only allowed if all sets are compatible.

    Parameters

    Returns StringSet

  • Returns whether this set is compatible with the given set. Compatibility is defined as follows:

    1. The empty set is compatible with all sets.
    2. Sets with different case folding are incompatible.

    Parameters

    Returns boolean

  • Returns whether this ⊂ other.

    Parameters

    Returns boolean

  • Returns whether this ⊃ other.

    Parameters

    Returns boolean

  • Returns whether this ⊆ other.

    Parameters

    Returns boolean

  • Returns whether this ⊇ other.

    Parameters

    Returns boolean

  • Returns the union of all given sets.

    Note: This operation is only allowed if all sets are compatible.

    Parameters

    Returns StringSet

  • Returns this set without the strings of the given set.

    Note: This operation is only allowed if all sets are compatible.

    Parameters

    Returns StringSet

  • Removes all single-character words from this set.

    Returns StringSet