Class FynotekWord

java.lang.Object
com.mathmaster13.fynotek.BaseFynotekWord
com.mathmaster13.fynotek.FynotekWord

public final class FynotekWord extends BaseFynotekWord
A class for handling words in Fynotek, a conlang by mochaspen. All objects created by this class are immutable. Fynotek documentarion can be found here.
Since:
1.0
Author:
mathmaster13
  • Field Details

    • isProper

      public final boolean isProper
      Represents if this FynotekWord is a proper noun or not.
      See Also:
    • FOLO

      @NotNull public static final @NotNull FynotekWord FOLO
      The irregular word folo, in its completely unmarked (root) form.
      Since:
      2.0
    • MAX_MAGNITUDE

      @NotNull public static final @NotNull BigInteger MAX_MAGNITUDE
      The maximum integer supported by Fynotek's number system. You can compare if a number x is too large or small with (x.abs().compareTo(MAX_MAGNITUDE) > 0).
      See Also:
  • Constructor Details

    • FynotekWord

      public FynotekWord(@NotNull @NotNull String word, boolean isProper)
      Converts a String and a boolean to a FynotekWord. The String contains the word itself, while the boolean represents whether the word is a proper noun: true if it is, and false if it is not. Leading and trailing whitespace is ignored (the String.trim() method is called on word). This constructor assumes that a word is in its root form, with no inflection.
      Parameters:
      word - word to be converted to a FynotekWord.
      isProper - true if this word is a proper noun, or false if it is not.
    • FynotekWord

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

      public FynotekWord(@NotNull @NotNull String word, @Nullable @Nullable Inflection inflection, boolean isProper)
      Converts a String to a FynotekWord, 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 or the OTHER case (since those forms and root forms are identical as strings). For example, the accusative form of the word "hyr" is "hor", and would be created with new FynotekWord("hor", Case.ACCUSATIVE, false). 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 FynotekWord.
      inflection - this word's inflection, or null if it does not have one.
      isProper - true if this word is a proper noun, or false if it is not.
  • Method Details

    • equals

      public boolean equals(Object o)
      Generated by IntelliJ IDEA Community.
      Overrides:
      equals in class BaseFynotekWord
    • hashCode

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

      @NotNull public @NotNull FynotekWord ablaut(@NotNull @NotNull BaseFynotekWord.Ablaut ablaut)
      Returns a copy of this FynotekWord marked for the specified ablaut. For proper nouns, a suffix is applied instead. 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 BaseFynotekWord.isMarked().
      Specified by:
      ablaut in class BaseFynotekWord
      Parameters:
      ablaut - the ablaut to mark this word as.
      Returns:
      a copy of this FynotekWord marked for the specified ablaut.
      Since:
      3.0
      See Also:
    • getAblaut

      @Nullable public @Nullable BaseFynotekWord.Ablaut getAblaut()
      Description copied from class: BaseFynotekWord
      Returns the BaseFynotekWord.Ablaut that this word is marked with, or null if it is completely unmarked (a root form).
      Overrides:
      getAblaut in class BaseFynotekWord
      Returns:
      the Ablaut that this word is marked with
      See Also:
    • nounCase

      @NotNull public @NotNull FynotekWord nounCase(@NotNull @NotNull FynotekWord.Case caseOfNoun) throws IllegalArgumentException
      Returns a copy of this FynotekWord inflected for the noun case specified by caseOfNoun. Note that the word "folo" as a common noun cannot be marked for the nominative case, and doing so throws an IllegalArgumentException. This method should be called before any suffix methods, not after. If a word has previously been marked for case or tense, it usually should not be marked again. If this method is called on a marked word, there is no guarantee for the result. Check for marking with BaseFynotekWord.isMarked().
      Parameters:
      caseOfNoun - the noun case to inflect this FynotekWord for.
      Returns:
      this FynotekWord inflected for the specified noun case.
      Throws:
      IllegalArgumentException
      See Also:
    • verbTense

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

      @NotNull public @NotNull FynotekWord suffix(@NotNull @NotNull String suffix)
      Returns a new FynotekWord with the specified suffix appended to the end of this word. If the suffix creates a phonotactically invalid sequence, n or a will be infixed as needed to make the resulting word phonotactically valid. Leading and trailing whitespace is ignored (the String.trim() method is called on suffix). This method applies a suffix, so no inflections should be called on a word after this method is called on it.
      Parameters:
      suffix - the suffix to be appended to the end of this FynotekWord
      Returns:
      a FynotekWord with the specified suffix appended to the end of it.
      See Also:
    • prefix

      @NotNull public @NotNull FynotekWord prefix(@NotNull @NotNull String prefix)
      Returns a new FynotekWord with the specified prefix appended to the beginning of this word. If the prefix creates a phonotactically invalid sequence, n or a will be infixed as needed to make the resulting word phonotactically valid. Leading and trailing whitespace is ignored (the String.trim() method is called on prefix).
      Parameters:
      prefix - the prefix to be appended to the beginning of this FynotekWord.
      Returns:
      a FynotekWord with the specified prefix appended to the beginning of it.
      See Also:
    • inflect

      @NotNull public @NotNull FynotekWord inflect(@Nullable @Nullable Inflection inflection)
      Description copied from class: BaseFynotekWord
      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 BaseFynotekWord.isMarked().
      Overrides:
      inflect in class BaseFynotekWord
      Parameters:
      inflection - the inflection to inflect this BaseFynotekWord for.
      Returns:
      this BaseFynotekWord inflected for the specified inflection.
      See Also:
    • match

      @NotNull public @NotNull FynotekWord 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.
      Overrides:
      match in class BaseFynotekWord
      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:
    • personSuffix

      @NotNull public @NotNull FynotekWord personSuffix(@NotNull @NotNull BaseFynotekWord.Person person)
      Description copied from class: BaseFynotekWord
      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.
      Specified by:
      personSuffix in class BaseFynotekWord
      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:
    • number

      @NotNull public static @NotNull String number(@NotNull @NotNull BigInteger num)
      Returns the Fynotek translation of the specified number. If the number's absolute value is greater than MAX_MAGNITUDE, an empty String is returned.
      Parameters:
      num - the number to be translated.
      Returns:
      the Fynotek translation of the specified number.
      Throws:
      IllegalArgumentException - If the number provided is too large for the number system to handle.
      See Also:
    • number

      @NotNull public static @NotNull String number(long num)
      Returns the Fynotek translation of the specified number.
      Parameters:
      num - the number to be translated.
      Returns:
      the Fynotek translation of the specified number.
    • isValidSequence

      public static boolean isValidSequence(@NotNull @NotNull String sequence)
      Returns whether the given sequence is phonotactically and orthographically valid in Fynotek. Capitalization is ignored (for example, "A" and "a" are treated the same way). Multiple words can be separated by whitespace, and this method will only return true if all words in sequence are valid. Leading and trailing whitespace is ignored (the String.trim() method is called on sequence). A sequence containing punctuation marks, numbers, or other non-letter characters returns false, as well as an empty sequence or one containing only whitespace. Note that despite that "annnnn" (with any number of Ns) is used in Fynotek, it is not considered a valid sequence because it breaks phonotactics (so only "an" and "ann" are valid sequences when used with this function).
      Parameters:
      sequence - the sequence to be checked for validity.
      Returns:
      true if sequence is a valid sequence, and false if otherwise.