Record Class RhythmFeatures
java.lang.Object
java.lang.Record
org.jjazz.rhythm.api.RhythmFeatures
- All Implemented Interfaces:
Serializable
public record RhythmFeatures(Genre genre, Division division, TempoRange tempoRange)
extends Record
implements Serializable
Rhythm general features.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct an object with all default values.RhythmFeatures(Genre genre, Division division, TempoRange tempoRange) Creates an instance of aRhythmFeaturesrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondivision()Returns the value of thedivisionrecord component.final booleanIndicates whether some other object is "equal to" this one.genre()Returns the value of thegenrerecord component.intCompute a matching score between this object and rf.static RhythmFeaturesguessFeatures(String text, int tempo) Try to guess features from a text (for example a style name).final inthashCode()Returns a hash code value for this object.Returns the value of thetempoRangerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
RhythmFeatures
public RhythmFeatures()Construct an object with all default values.Values are set to UNKNOWN, except for TempoRange which is set to TempoRange.ALL_TEMPO.
-
RhythmFeatures
Creates an instance of aRhythmFeaturesrecord class.- Parameters:
genre- the value for thegenrerecord componentdivision- the value for thedivisionrecord componenttempoRange- the value for thetempoRangerecord component
-
-
Method Details
-
getMatchingScore
Compute a matching score between this object and rf.Score calculation on each variable:
- Add 100 points if genre values are defined and match
- Add 30 points division values are defined and match
- Add up to 30 points depending how TempoRange values match- Parameters:
rf-- Returns:
- The matching score
-
guessFeatures
Try to guess features from a text (for example a style name).Use defaultValues to set some values in the returned RhythmFeatures object.
- Parameters:
text- eg "Bossa Nova"tempo- Ignored if negative- Returns:
- If no match, all features will be UNKNOWN and TempoRange.ALL_TEMPO for the TempoRange
-
toString
-
hashCode
-
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). -
genre
Returns the value of thegenrerecord component.- Returns:
- the value of the
genrerecord component
-
division
Returns the value of thedivisionrecord component.- Returns:
- the value of the
divisionrecord component
-
tempoRange
Returns the value of thetempoRangerecord component.- Returns:
- the value of the
tempoRangerecord component
-