Package fr.becpg.repo.helper
Record Class SearchWord
java.lang.Object
java.lang.Record
fr.becpg.repo.helper.SearchWord
- Record Components:
raw- the word as typedstem- the word without its plural or feminine ending
A word of a free-text search, kept both as typed and reduced to a common form, so that a plural, a feminine or an
irregular form finds its base word while a word being typed still finds the words it starts.
The word is expected lower-cased and without accents.
-
Field Summary
FieldsModifier and TypeFieldDescriptionEndings rewritten, in this order, to reach the common form: English "-ies" plural, French "-aux" plural of an "-al" word (but not "-eaux", the plural of "-eau"), "s" or "x" plural, then the "-ee" of a feminine past participle.private final StringThe field for therawrecord component.private final StringThe field for thestemrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionSearchWord(String raw, String stem) Creates an instance of aSearchWordrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.(package private) booleanisStartedBy(SearchWord prefix) Tells whether a typed word starts this word, as typed or in its common form.(package private) static SearchWordBuilds the search word of a lower-cased, accent-free word.raw()Returns the value of therawrecord component.stem()Returns the value of thestemrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
raw
The field for therawrecord component. -
stem
The field for thestemrecord component. -
ENDING_RULES
Endings rewritten, in this order, to reach the common form: English "-ies" plural, French "-aux" plural of an "-al" word (but not "-eaux", the plural of "-eau"), "s" or "x" plural, then the "-ee" of a feminine past participle. A short word is left untouched, to keep "les", "taux" or "pies" readable.
-
-
Constructor Details
-
Method Details
-
of
Builds the search word of a lower-cased, accent-free word.- Parameters:
word- the word- Returns:
- the word with its common form
-
isStartedBy
Tells whether a typed word starts this word, as typed or in its common form.- Parameters:
prefix- the typed word- Returns:
- true when this word starts with it
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
raw
Returns the value of therawrecord component.- Returns:
- the value of the
rawrecord component
-
stem
Returns the value of thestemrecord component.- Returns:
- the value of the
stemrecord component
-