Package com.mathmaster13.fynotek
Class FynotekWord
java.lang.Object
com.mathmaster13.fynotek.BaseFynotekWord
com.mathmaster13.fynotek.FynotekWord
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
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Represents the case of a Fynotek noun.Nested classes/interfaces inherited from class com.mathmaster13.fynotek.BaseFynotekWord
BaseFynotekWord.Ablaut, BaseFynotekWord.Person, BaseFynotekWord.Tense
-
Field Summary
Modifier and TypeFieldDescriptionstatic final @NotNull FynotekWord
The irregular word folo, in its completely unmarked (root) form.final boolean
Represents if this FynotekWord is a proper noun or not.static final @NotNull BigInteger
The maximum integer supported by Fynotek's number system.Fields inherited from class com.mathmaster13.fynotek.BaseFynotekWord
beginning, end, inflection, vowels
-
Constructor Summary
ConstructorDescriptionFynotekWord
(@NotNull String word) Converts a String to a FynotekWord.FynotekWord
(@NotNull String word, boolean isProper) Converts a String and a boolean to a FynotekWord.FynotekWord
(@NotNull String word, @Nullable Inflection inflection, boolean isProper) Converts a String to a FynotekWord, and marks the word as having the specified inflection. -
Method Summary
Modifier and TypeMethodDescription@NotNull FynotekWord
ablaut
(@NotNull BaseFynotekWord.Ablaut ablaut) Returns a copy of this FynotekWord marked for the specified ablaut.boolean
Generated by IntelliJ IDEA Community.@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 FynotekWord
inflect
(@Nullable Inflection inflection) Returns a copy of this word inflected for the inflection specified byinflection
.static boolean
isValidSequence
(@NotNull String sequence) Returns whether the given sequence is phonotactically and orthographically valid in Fynotek.@NotNull FynotekWord
match
(@NotNull BaseFynotekWord word) Returns a copy of this word inflected for the same case or tense asword
.@NotNull FynotekWord
nounCase
(@NotNull FynotekWord.Case caseOfNoun) Returns a copy of this FynotekWord inflected for the noun case specified bycaseOfNoun
.static @NotNull String
number
(long num) Returns the Fynotek translation of the specified number.static @NotNull String
number
(@NotNull BigInteger num) Returns the Fynotek translation of the specified number.@NotNull FynotekWord
personSuffix
(@NotNull BaseFynotekWord.Person person) Returns a copy of this word with a suffix added to mark the first, second, or third person.@NotNull FynotekWord
Returns a new FynotekWord with the specified prefix appended to the beginning of this word.@NotNull FynotekWord
Returns a new FynotekWord with the specified suffix appended to the end of this word.@NotNull FynotekWord
verbTense
(@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 bytenseOfVerb
.Methods inherited from class com.mathmaster13.fynotek.BaseFynotekWord
isMarked, separateVowels, toString
-
Field Details
-
isProper
public final boolean isProperRepresents if this FynotekWord is a proper noun or not.- See Also:
-
_ablaut(Ablaut)
properSuffix(Ablaut)
match(BaseFynotekWord)
-
FOLO
The irregular word folo, in its completely unmarked (root) form.- Since:
- 2.0
-
MAX_MAGNITUDE
The maximum integer supported by Fynotek's number system. You can compare if a numberx
is too large or small with(x.abs().compareTo(MAX_MAGNITUDE) > 0)
.- See Also:
-
-
Constructor Details
-
FynotekWord
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, andfalse
if it is not. Leading and trailing whitespace is ignored (theString.trim()
method is called onword
). 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, orfalse
if it is not.
-
FynotekWord
Converts a String to a FynotekWord. The word is assumed not to be a proper noun. Leading and trailing whitespace is ignored (theString.trim()
method is called onword
). 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 (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 or theOTHER
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 withnew FynotekWord("hor", Case.ACCUSATIVE, false)
. 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 FynotekWord.inflection
- this word's inflection, ornull
if it does not have one.isProper
-true
if this word is a proper noun, orfalse
if it is not.
-
-
Method Details
-
equals
Generated by IntelliJ IDEA Community.- Overrides:
equals
in classBaseFynotekWord
-
hashCode
public int hashCode()Generated by IntelliJ IDEA Community.- Overrides:
hashCode
in classBaseFynotekWord
-
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 withBaseFynotekWord.isMarked()
.- Specified by:
ablaut
in classBaseFynotekWord
- 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
Description copied from class:BaseFynotekWord
Returns theBaseFynotekWord.Ablaut
that this word is marked with, ornull
if it is completely unmarked (a root form).- Overrides:
getAblaut
in classBaseFynotekWord
- 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 bycaseOfNoun
. Note that the word "folo" as a common noun cannot be marked for the nominative case, and doing so throws anIllegalArgumentException
. 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 withBaseFynotekWord.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
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 bytenseOfVerb
. 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 withBaseFynotekWord.isMarked()
.- Specified by:
verbTense
in classBaseFynotekWord
- Parameters:
tenseOfVerb
- the verb tense to inflect this FynotekWord for.- Returns:
- this FynotekWord inflected for the specified verb tense.
- See Also:
-
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 (theString.trim()
method is called onsuffix
). 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
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 (theString.trim()
method is called onprefix
).- 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
Description copied from class:BaseFynotekWord
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 withBaseFynotekWord.isMarked()
.- Overrides:
inflect
in classBaseFynotekWord
- Parameters:
inflection
- the inflection to inflect this BaseFynotekWord for.- Returns:
- this BaseFynotekWord inflected for the specified inflection.
- 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.- Overrides:
match
in classBaseFynotekWord
- 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
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 classBaseFynotekWord
- 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
Returns the Fynotek translation of the specified number. If the number's absolute value is greater thanMAX_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
Returns the Fynotek translation of the specified number.- Parameters:
num
- the number to be translated.- Returns:
- the Fynotek translation of the specified number.
-
isValidSequence
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 returntrue
if all words insequence
are valid. Leading and trailing whitespace is ignored (theString.trim()
method is called onsequence
). A sequence containing punctuation marks, numbers, or other non-letter characters returnsfalse
, 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
ifsequence
is a valid sequence, andfalse
if otherwise.
-