Class BaseFynotekWord

java.lang.Object
com.mathmaster13.fynotek.BaseFynotekWord
Direct Known Subclasses:
FynotekWord, OldFynotekWord

public abstract sealed class BaseFynotekWord extends Object permits FynotekWord, OldFynotekWord
A class for handling words in Fynotek, a conlang by mochaspen, in both its modern and old form. The parent class of FynotekWord and OldFynotekWord, containing all shared code between the two. All instances of this class' subclasses are immutable. All subclasses of this class allow words to be instantiated that are not phonotactically or orthographically valid in Fynotek, due to names, loanwords, and other reasons. However, these classes strictly adhere to the phonotactics and orthography of Fynotek. As such, each class provides a static isValidSequence method to check the validity of a word if desired.
Since:
1.0
Author:
mathmaster13
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Represents Fynotek ablaut.
    static enum 
    Represents the concept of person on a Fynotek verb.
    static enum 
    Represents the tense of a Fynotek verb.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final @NotNull String
    The part of a Fynotek word before its final vowel or diphthong.
    final @NotNull String
    The part of a Fynotek word after its final vowel or diphthong.
    final @Nullable Inflection
    Represents the case or tense that this word is marked with.
    final @NotNull String
    A Fynotek word's final vowel or diphthong.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BaseFynotekWord(@NotNull String word)
    Converts a String to a BaseFynotekWord.
    BaseFynotekWord(@NotNull String word, @Nullable Inflection inflection)
    Converts a String to a BaseFynotekWord, and marks the word as having the specified inflection.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract @NotNull BaseFynotekWord
    ablaut(@NotNull BaseFynotekWord.Ablaut ablaut)
    Returns a copy of this BaseFynotekWord marked for the specified ablaut.
    boolean
    Checks strict value-based equality of this word and an Object.
    Returns the BaseFynotekWord.Ablaut that this word is marked with, or null if it is completely unmarked (a root form).
    int
    Generated by IntellIJ IDEA Community.
    inflect(@Nullable Inflection inflection)
    Returns a copy of this word inflected for the inflection specified by inflection.
    final boolean
    Returns whether this BaseFynotekWord is marked or not.
    match(@NotNull BaseFynotekWord word)
    Returns a copy of this word inflected for the same case or tense as word.
    abstract @NotNull BaseFynotekWord
    Returns a copy of this word with a suffix added to mark the first, second, or third person.
    static @NotNull String[]
    separateVowels(@NotNull String word)
    Returns an array of 3 Strings: the first containing the part of word before its final vowel or diphthong, the second containing its final vowel or diphthong, and the third containing the part after its final vowel or diphthong.
    @NotNull String
    Returns a String representation of this word.
    abstract @NotNull BaseFynotekWord
    Returns a copy of this word inflected for the verb tense specified by tenseOfVerb.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • BaseFynotekWord

      public BaseFynotekWord(@NotNull @NotNull String word)
      Converts a String to a BaseFynotekWord. Leading and trailing whitespace is ignored (the String.trim() method is called on word), and the word will always be converted to lowercase. This constructor assumes that a word is in its root form, with no inflection.
      Parameters:
      word - word to be converted to a BaseFynotekWord.
    • BaseFynotekWord

      public BaseFynotekWord(@NotNull @NotNull String word, @Nullable @Nullable Inflection inflection)
      Converts a String to a BaseFynotekWord, and marks the word as having the specified inflection. Leading and trailing whitespace is ignored (the String.trim() method is called on word), and the word will always be converted to lowercase. This constructor should be used with words known at compile time, or with words known to be marked for the present tense (since the present-tense form and the root form are identical as strings). A root form (the abstract form of a word with no case or tense marking) is represented by a null inflection.
      Parameters:
      word - word to be converted to a BaseFynotekWord.
      inflection - this word's inflection, or null if it does not have one.
      See Also:
  • Method Details

    • toString

      @NotNull public @NotNull String toString()
      Returns a String representation of this word.
      Overrides:
      toString in class Object
      Returns:
      String representation of this word.
    • equals

      public boolean equals(Object o)
      Checks strict value-based equality of this word and an Object. If two words have the same string representation but different inflections, they will not be considered equal. For example, the word "tau" marked in both the hypothetical future and hypothetical gnomic tenses is "tuu", but since those two words are marked with different tenses, they are not considered equal. Generated by IntellIJ IDEA Community.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Generated by IntellIJ IDEA Community.
      Overrides:
      hashCode in class Object
    • ablaut

      @NotNull public abstract @NotNull BaseFynotekWord ablaut(@NotNull @NotNull BaseFynotekWord.Ablaut ablaut)
      Returns a copy of this BaseFynotekWord marked for the specified ablaut. If this function is used on a word, it is assumed that the word has been marked for case or tense, but the case or tense is unknown. This function should be called before any suffix functions, not after. If a word has previously been inflected, it usually should not be inflected again. If this function is called on a marked word, there is no guarantee for the result. Check for marking with isMarked().
      Parameters:
      ablaut - the ablaut to mark this word as.
      Returns:
      a copy of this BaseFynotekWord marked for the specified ablaut.
      Since:
      3.0
      See Also:
    • separateVowels

      @NotNull public static @NotNull String[] separateVowels(@NotNull @NotNull String word)
      Returns an array of 3 Strings: the first containing the part of word before its final vowel or diphthong, the second containing its final vowel or diphthong, and the third containing the part after its final vowel or diphthong. Leading and trailing whitespace is ignored (the String.trim() method is called on word), and the word will always be converted to lowercase. If a word has no vowels (as defined by isVowel(char)), the word is placed as the third string.
      Parameters:
      word - the word to be parsed for final vowels
      Returns:
      an array containing word separated by its final vowel or diphthong.
      Since:
      3.0
    • getAblaut

      @Nullable public @Nullable BaseFynotekWord.Ablaut getAblaut()
      Returns the BaseFynotekWord.Ablaut that this word is marked with, or null if it is completely unmarked (a root form).
      Returns:
      the Ablaut that this word is marked with
      Since:
      2.0
      See Also:
    • verbTense

      @NotNull public abstract @NotNull BaseFynotekWord verbTense(@NotNull @NotNull BaseFynotekWord.Tense tense)
      Returns a copy of this word inflected for the verb tense specified by tenseOfVerb. This function should be called before any suffix functions, not after. If a word has previously been marked for case or tense, it usually should not be marked again. If this function is called on a marked word, there is no guarantee for the result. Check for marking with isMarked().
      Parameters:
      tense - the verb tense to inflect this BaseFynotekWord for.
      Returns:
      this BaseFynotekWord inflected for the specified verb tense.
      See Also:
    • inflect

      @NotNull public @NotNull BaseFynotekWord inflect(@Nullable @Nullable Inflection inflection)
      Returns a copy of this word inflected for the inflection specified by inflection. This function should be called before any suffix functions, not after. If a word has previously been inflected, it usually should not be inflected again. If this function is called on a marked word, there is no guarantee for the result. Check for marking with isMarked().
      Parameters:
      inflection - the inflection to inflect this BaseFynotekWord for.
      Returns:
      this BaseFynotekWord inflected for the specified inflection.
      Since:
      3.0
      See Also:
    • match

      @NotNull public @NotNull BaseFynotekWord match(@NotNull @NotNull BaseFynotekWord word)
      Returns a copy of this word inflected for the same case or tense as word. This function calls inflect(word.inflection). This function should be called before any suffix functions, not after. If a word has previously been marked for case or tense, it usually should not be marked again. If this function is called on a marked word, there is no guarantee for the result.
      Parameters:
      word - the BaseFynotekWord to match this word's inflection with.
      Returns:
      this word inflected for the same case or tense as word.
      See Also:
    • isMarked

      public final boolean isMarked()
      Returns whether this BaseFynotekWord is marked or not. Specifically, returns inflection != null.
      Returns:
      true if this BaseFynotekWord has been marked by ablaut or a proper noun suffix, and false if it has not been.
      See Also:
    • personSuffix

      @NotNull public abstract @NotNull BaseFynotekWord personSuffix(@NotNull @NotNull BaseFynotekWord.Person person)
      Returns a copy of this word with a suffix added to mark the first, second, or third person. This method applies a suffix, so no inflections should be called on a word after this method is called on it.
      Parameters:
      person - the person to mark this word for.
      Returns:
      this word with a suffix added to mark the first, second, or third person.
      See Also: