Interface RhythmParameter<E>
- Type Parameters:
E- The type of value of this RhythmParameter. E.toString() should return a short (max ~30 characters) user-readable string.
- All Known Implementing Classes:
RP_BassStyle, RP_DrumsStyle, RP_EnumState, RP_Integer, RP_State, RP_StringSet, RP_SYS_CustomPhrase, RP_SYS_DrumsTransform, RP_SYS_Fill, RP_SYS_Intensity, RP_SYS_Marker, RP_SYS_Mute, RP_SYS_OverrideTracks, RP_SYS_TempoFactor, RP_SYS_Variation
public interface RhythmParameter<E>
Define a parameter that influences the way a Rhythm generates music.
A RhythmParameter implementation can have additional capabilities by implementing additional interfaces, such as RpEnumerable, RpCustomEditorFactory, RpViewerRendererFactory, etc.
A RhythmParameter value can be set via SongStructure.setRPValue().
-
Method Summary
Modifier and TypeMethodDescriptiondefault EcloneValue(E value) Clone the specified value.<T> EconvertValue(RhythmParameter<T> rp, T rpValue) Convert the value of a compatible RhythmParameter to a value for this RhythmParameter.static RhythmParameter<?> findFirstCompatibleRp(List<? extends RhythmParameter<?>> rps, RhythmParameter<?> rp) Return the first RhythmParameter in rps compatible with rp.Get a copy of this RhythmParameter.The description of this rhythm parameter.getDisplayValue(E value) Get a short String representation of the value.getId()getValueDescription(E value) Provide an optional description or help text associated to the specified value.booleanisCompatibleWith(RhythmParameter<?> rp) Indicate if rp is compatible with this RhythmParameter.default booleanIndicate if this RhythmParameter is a primary parameter for its rhythm.booleanisValidValue(E value) Try to convert the specified string to a RhythmParameter value.saveAsString(E value) Try to convert the specified RhythmParameter value to a string.
-
Method Details
-
findFirstCompatibleRp
static RhythmParameter<?> findFirstCompatibleRp(List<? extends RhythmParameter<?>> rps, RhythmParameter<?> rp) Return the first RhythmParameter in rps compatible with rp.- Parameters:
rps-rp-- Returns:
- Null if no compatible RhythmParameter found
-
getId
String getId()- Returns:
- A unique identifier. Usually the english name.
-
getDisplayName
String getDisplayName()- Returns:
- The localized display name of the rhythm parameter.
-
getDescription
-
getDisplayValue
-
getValueDescription
-
getDefaultValue
E getDefaultValue()- Returns:
- Object The default value.
-
saveAsString
-
loadFromString
Try to convert the specified string to a RhythmParameter value.- Parameters:
s- A string produced by valueToString().- Returns:
- Throws:
ParseException- See Also:
-
isValidValue
- Parameters:
value-- Returns:
- True is value is valid.
-
cloneValue
-
isCompatibleWith
Indicate if rp is compatible with this RhythmParameter.NOTE: if rp1 is compatible with rp2, then rp2 must be compatible with rp1 as well.
- Parameters:
rp-- Returns:
- True if a rp's value can be converted to a value for this RhythmParameter.
-
convertValue
Convert the value of a compatible RhythmParameter to a value for this RhythmParameter.- Type Parameters:
T- A RhythmParameter value- Parameters:
rp- A compatible RhythmParameterrpValue- The value to convert- Returns:
- The rpValue converted for this RhythmParameter. Can't be null.
- Throws:
IllegalArgumentException- If rp is not a compatible with this RhythmParameter.
-
getCopy
Get a copy of this RhythmParameter.- Parameters:
r- Can be null. Optionally set the target Rhythm of the returned RhythmParameter -though it might be ignored by the implementing method.- Returns:
-
isPrimary
default boolean isPrimary()Indicate if this RhythmParameter is a primary parameter for its rhythm.This information is made available mainly for the user interface, e.g. to select which RhythmParameters to show first.
Default implementation returns true.
- Returns:
-