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
ConstructorsConstructorDescriptionRP_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 doublecalculatePercentage(Integer value) final IntegercalculateValue(double y) Calculate the RhythmParameter value corresponding to a percentage of the value range.<T> IntegerconvertValue(RhythmParameter<T> rp, T value) Convert the value of a compatible RhythmParameter to a value for this RhythmParameter.booleanfinal Integerfinal StringThe description of this rhythm parameter.final StringgetDisplayValue(Integer value) Get a short String representation of the value.final StringgetId()final Integerfinal Integerfinal IntegergetNextValue(Integer value) Get the next value after specified value.Get the list of possible values for this RhythmParameter.final IntegergetPreviousValue(Integer value) Get the next value before specified value.final intgetStep()getValueDescription(Integer value) Provide an optional description or help text associated to the specified value.inthashCode()booleanisCompatibleWith(RhythmParameter<?> rp) Indicate if rp is compatible with this RhythmParameter.booleanIndicate if this RhythmParameter is a primary parameter for its rhythm.final booleanisValidValue(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 StringtoString()Methods inherited from interface org.jjazz.rhythm.api.RhythmParameter
cloneValue
-
Constructor Details
-
Method Details
-
isPrimary
public boolean isPrimary()Description copied from interface:RhythmParameterIndicate 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:
isPrimaryin interfaceRhythmParameter<Integer>- Returns:
-
hashCode
public int hashCode() -
equals
-
getStep
public final int getStep() -
getDescription
Description copied from interface:RhythmParameterThe description of this rhythm parameter.- Specified by:
getDescriptionin interfaceRhythmParameter<Integer>- Returns:
-
getMaxValue
- Specified by:
getMaxValuein interfaceRpEnumerable<Integer>
-
getMinValue
- Specified by:
getMinValuein interfaceRpEnumerable<Integer>
-
getId
- Specified by:
getIdin interfaceRhythmParameter<Integer>- Returns:
- A unique identifier. Usually the english name.
-
getDisplayName
- Specified by:
getDisplayNamein interfaceRhythmParameter<Integer>- Returns:
- The localized display name of the rhythm parameter.
-
getNextValue
Description copied from interface:RpEnumerableGet the next value after specified value.- Specified by:
getNextValuein interfaceRpEnumerable<Integer>- Returns:
- Object
-
getPreviousValue
Description copied from interface:RpEnumerableGet the next value before specified value.- Specified by:
getPreviousValuein interfaceRpEnumerable<Integer>- Returns:
- Object
-
getDefaultValue
- Specified by:
getDefaultValuein interfaceRhythmParameter<Integer>- Returns:
- Object The default value.
-
isValidValue
- Specified by:
isValidValuein interfaceRhythmParameter<Integer>- Returns:
- True is value is valid.
-
calculateValue
Description copied from interface:RpEnumerableCalculate 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:
calculateValuein interfaceRpEnumerable<Integer>- Parameters:
y- A float between 0 and 1.- Returns:
- A RhythmParameter value.
-
calculatePercentage
- Specified by:
calculatePercentagein interfaceRpEnumerable<Integer>- Returns:
- A percentage between 0 and 1 representing value in the range of the possible values.
-
toString
-
getPossibleValues
Description copied from interface:RpEnumerableGet the list of possible values for this RhythmParameter.Only the first 10000 values are returned.
- Specified by:
getPossibleValuesin interfaceRpEnumerable<Integer>- Returns:
-
saveAsString
Description copied from interface:RhythmParameterTry to convert the specified RhythmParameter value to a string.- Specified by:
saveAsStringin interfaceRhythmParameter<Integer>- Returns:
- Can be null if value is invalid or RhytmParameter does not have this capability.
- See Also:
-
loadFromString
Description copied from interface:RhythmParameterTry to convert the specified string to a RhythmParameter value.- Specified by:
loadFromStringin interfaceRhythmParameter<Integer>- Parameters:
s- A string produced by valueToString().- Returns:
- Can be null if conversion failed.
- See Also:
-
getValueDescription
Description copied from interface:RhythmParameterProvide an optional description or help text associated to the specified value.- Specified by:
getValueDescriptionin interfaceRhythmParameter<Integer>- Returns:
- Can be null.
-
isCompatibleWith
Description copied from interface:RhythmParameterIndicate 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:
isCompatibleWithin interfaceRhythmParameter<Integer>- Returns:
- True if a rp's value can be converted to a value for this RhythmParameter.
-
convertValue
Description copied from interface:RhythmParameterConvert the value of a compatible RhythmParameter to a value for this RhythmParameter.- Specified by:
convertValuein 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:RhythmParameterGet a short String representation of the value.- Specified by:
getDisplayValuein interfaceRhythmParameter<Integer>- Returns:
- Can be an empty String.
-