Package com.mathmaster13.fynotek
Class BaseFynotekWord
java.lang.Object
com.mathmaster13.fynotek.BaseFynotekWord
- Direct Known Subclasses:
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
Modifier and TypeClassDescriptionstatic 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
Modifier and TypeFieldDescriptionfinal @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
ConstructorDescriptionBaseFynotekWord
(@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 TypeMethodDescriptionabstract @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.@Nullable BaseFynotekWord.Ablaut
Returns theBaseFynotekWord.Ablaut
that this word is marked with, ornull
if it is completely unmarked (a root form).int
hashCode()
Generated by IntellIJ IDEA Community.@NotNull BaseFynotekWord
inflect
(@Nullable Inflection inflection) Returns a copy of this word inflected for the inflection specified byinflection
.final boolean
isMarked()
Returns whether this BaseFynotekWord is marked or not.@NotNull BaseFynotekWord
match
(@NotNull BaseFynotekWord word) Returns a copy of this word inflected for the same case or tense asword
.abstract @NotNull BaseFynotekWord
personSuffix
(@NotNull BaseFynotekWord.Person person) 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 ofword
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
toString()
Returns a String representation of this word.abstract @NotNull BaseFynotekWord
verbTense
(@NotNull BaseFynotekWord.Tense tense) Returns a copy of this word inflected for the verb tense specified bytenseOfVerb
.
-
Field Details
-
beginning
The part of a Fynotek word before its final vowel or diphthong.- See Also:
-
vowels
A Fynotek word's final vowel or diphthong.- See Also:
-
BaseFynotekWord(String)
_ablaut(Ablaut)
-
end
The part of a Fynotek word after its final vowel or diphthong.- See Also:
-
inflection
Represents the case or tense that this word is marked with. Anull
value represents a word's root form. Note that a root form is not the same as a word marked for the present tense—seeInflection
for details.- Since:
- 2.0
- See Also:
-
-
Constructor Details
-
BaseFynotekWord
Converts a String to a BaseFynotekWord. Leading and trailing whitespace is ignored (theString.trim()
method is called onword
), 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
Converts a String to a BaseFynotekWord, and marks the word as having the specified inflection. Leading and trailing whitespace is ignored (theString.trim()
method is called onword
), 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 anull
inflection.- Parameters:
word
- word to be converted to a BaseFynotekWord.inflection
- this word's inflection, ornull
if it does not have one.- See Also:
-
-
Method Details
-
toString
Returns a String representation of this word. -
equals
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. -
hashCode
public int hashCode()Generated by IntellIJ IDEA Community. -
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 withisMarked()
.- 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
Returns an array of 3 Strings: the first containing the part ofword
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 (theString.trim()
method is called onword
), and the word will always be converted to lowercase. If a word has no vowels (as defined byisVowel(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
Returns theBaseFynotekWord.Ablaut
that this word is marked with, ornull
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 bytenseOfVerb
. 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 withisMarked()
.- Parameters:
tense
- the verb tense to inflect this BaseFynotekWord for.- Returns:
- this BaseFynotekWord inflected for the specified verb tense.
- See Also:
-
inflect
Returns a copy of this word inflected for the inflection specified byinflection
. 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 withisMarked()
.- Parameters:
inflection
- the inflection to inflect this BaseFynotekWord for.- Returns:
- this BaseFynotekWord inflected for the specified inflection.
- Since:
- 3.0
- See Also:
-
match
Returns a copy of this word inflected for the same case or tense asword
. This function callsinflect(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, returnsinflection != null
.- Returns:
true
if this BaseFynotekWord has been marked by ablaut or a proper noun suffix, andfalse
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:
-