Package org.jjazz.rhythm.api
Class RP_Integer
java.lang.Object
org.jjazz.rhythm.api.RP_Integer
- All Implemented Interfaces:
RhythmParameter<Integer>
,RpEnumerable<Integer>
- Direct Known Subclasses:
RP_STD_Intensity
,RP_SYS_TempoFactor
A RhythmParemeter representing positive integer values.
-
Constructor Summary
ConstructorDescriptionRP_Integer
(String id, String name, String description, boolean isPrimary, int defaultVal, int minValue, int maxValue, int step) Create a RP_Integer.Created instance is primary by default. -
Method Summary
Modifier and TypeMethodDescriptionfinal double
calculatePercentage
(Integer value) final Integer
calculateValue
(double y) Calculate the RhythmParameter value corresponding to a percentage of the value range.<T> Integer
convertValue
(RhythmParameter<T> rp, T value) Convert the value of a compatible RhythmParameter to a value for this RhythmParameter.boolean
final Integer
final String
The description of this rhythm parameter.final String
getDisplayValue
(Integer value) Get a short String representation of the value.final String
getId()
final Integer
final Integer
final Integer
getNextValue
(Integer value) Get the next value after specified value.Get the list of possible values for this RhythmParameter.final Integer
getPreviousValue
(Integer value) Get the next value before specified value.final int
getStep()
getValueDescription
(Integer value) Provide an optional description or help text associated to the specified value.int
hashCode()
boolean
isCompatibleWith
(RhythmParameter<?> rp) Indicate if rp is compatible with this RhythmParameter.boolean
Indicate if this RhythmParameter is a primary parameter for its rhythm.final boolean
isValidValue
(Integer value) Try to convert the specified string to a RhythmParameter value.saveAsString
(Integer value) Try to convert the specified RhythmParameter value to a string.final String
toString()
Methods inherited from interface org.jjazz.rhythm.api.RhythmParameter
cloneValue
-
Constructor Details
-
Method Details
-
isPrimary
public boolean isPrimary()Description copied from interface:RhythmParameter
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.
- Specified by:
isPrimary
in interfaceRhythmParameter<Integer>
- Returns:
-
hashCode
public int hashCode() -
equals
-
getStep
public final int getStep() -
getDescription
Description copied from interface:RhythmParameter
The description of this rhythm parameter.- Specified by:
getDescription
in interfaceRhythmParameter<Integer>
- Returns:
-
getMaxValue
- Specified by:
getMaxValue
in interfaceRpEnumerable<Integer>
-
getMinValue
- Specified by:
getMinValue
in interfaceRpEnumerable<Integer>
-
getId
- Specified by:
getId
in interfaceRhythmParameter<Integer>
- Returns:
- A unique identifier. Usually the english name.
-
getDisplayName
- Specified by:
getDisplayName
in interfaceRhythmParameter<Integer>
- Returns:
- The localized display name of the rhythm parameter.
-
getNextValue
Description copied from interface:RpEnumerable
Get the next value after specified value.- Specified by:
getNextValue
in interfaceRpEnumerable<Integer>
- Returns:
- Object
-
getPreviousValue
Description copied from interface:RpEnumerable
Get the next value before specified value.- Specified by:
getPreviousValue
in interfaceRpEnumerable<Integer>
- Returns:
- Object
-
getDefaultValue
- Specified by:
getDefaultValue
in interfaceRhythmParameter<Integer>
- Returns:
- Object The default value.
-
isValidValue
- Specified by:
isValidValue
in interfaceRhythmParameter<Integer>
- Returns:
- True is value is valid.
-
calculateValue
Description copied from interface:RpEnumerable
Calculate the RhythmParameter value corresponding to a percentage of the value range.For example if RhythmParameter is an integer between 0 and 4: percentage=0 -> value=0 percentage=0.5 -> value=2 percentage=1 -> value=4.
- Specified by:
calculateValue
in interfaceRpEnumerable<Integer>
- Parameters:
y
- A float between 0 and 1.- Returns:
- A RhythmParameter value.
-
calculatePercentage
- Specified by:
calculatePercentage
in interfaceRpEnumerable<Integer>
- Returns:
- A percentage between 0 and 1 representing value in the range of the possible values.
-
toString
-
getPossibleValues
Description copied from interface:RpEnumerable
Get the list of possible values for this RhythmParameter.Only the first 10000 values are returned.
- Specified by:
getPossibleValues
in interfaceRpEnumerable<Integer>
- Returns:
-
saveAsString
Description copied from interface:RhythmParameter
Try to convert the specified RhythmParameter value to a string.- Specified by:
saveAsString
in interfaceRhythmParameter<Integer>
- Returns:
- Can be null if value is invalid or RhytmParameter does not have this capability.
- See Also:
-
loadFromString
Description copied from interface:RhythmParameter
Try to convert the specified string to a RhythmParameter value.- Specified by:
loadFromString
in interfaceRhythmParameter<Integer>
- Parameters:
s
- A string produced by valueToString().- Returns:
- Can be null if conversion failed.
- See Also:
-
getValueDescription
Description copied from interface:RhythmParameter
Provide an optional description or help text associated to the specified value.- Specified by:
getValueDescription
in interfaceRhythmParameter<Integer>
- Returns:
- Can be null.
-
isCompatibleWith
Description copied from interface:RhythmParameter
Indicate if rp is compatible with this RhythmParameter.NOTE: if rp1 is compatible with rp2, then rp2 must be compatible with rp1 as well.
- Specified by:
isCompatibleWith
in interfaceRhythmParameter<Integer>
- Returns:
- True if a rp's value can be converted to a value for this RhythmParameter.
-
convertValue
Description copied from interface:RhythmParameter
Convert the value of a compatible RhythmParameter to a value for this RhythmParameter.- Specified by:
convertValue
in interfaceRhythmParameter<Integer>
- Type Parameters:
T
- A RhythmParameter value- Parameters:
rp
- A compatible RhythmParametervalue
- The value to convert- Returns:
- The rpValue converted for this RhythmParameter. Can't be null.
-
getDisplayValue
Description copied from interface:RhythmParameter
Get a short String representation of the value.- Specified by:
getDisplayValue
in interfaceRhythmParameter<Integer>
- Returns:
- Can be an empty String.
-