Class MeasureType
java.lang.Object
dev.jcputney.elearning.parser.input.scorm2004.ims.ss.types.MeasureType
- All Implemented Interfaces:
Serializable
A class representing a specific measure type in a decimal format, constrained by specific bounds
and precision requirements.
This class ensures that the value is within the range of -1 to 1 (inclusive) and formatted to at least four decimal places. Instances of this class are immutable.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for the MeasureType class.MeasureType(BigDecimal value) Constructs a MeasureType instance with the specified value. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetValue()Retrieves the current decimal value of the measure.inthashCode()static MeasureTypeParses a string as a MeasureType.toString()Returns the string representation of the measure value, formatted to at least four decimal places.value()Retrieves the current value of the measure.
-
Constructor Details
-
MeasureType
public MeasureType()Default constructor for the MeasureType class. -
MeasureType
Constructs a MeasureType instance with the specified value.- Parameters:
value- the decimal value for the measure must be between -1 and 1 with at least four decimal digits.- Throws:
IllegalArgumentException- if the value is out of range or does not have at least four decimal digits.
-
-
Method Details
-
parse
Parses a string as a MeasureType.- Parameters:
value- the string representation of the measure must represent a decimal between -1 and 1.- Returns:
- a new MeasureType instance.
- Throws:
IllegalArgumentException- if the value is out of range or not a valid decimal format.
-
toString
Returns the string representation of the measure value, formatted to at least four decimal places. -
getValue
Retrieves the current decimal value of the measure.- Returns:
- the decimal value of the measure as a BigDecimal.
-
equals
-
hashCode
public int hashCode() -
value
Retrieves the current value of the measure.- Returns:
- the decimal value of the measure as a BigDecimal.
-