java.lang.Object
dev.jcputney.elearning.parser.input.scorm2004.ims.ss.types.MeasureType
All Implemented Interfaces:
Serializable

public final class MeasureType extends Object implements 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 Details

    • MeasureType

      public MeasureType()
      Default constructor for the MeasureType class.
    • MeasureType

      public MeasureType(BigDecimal value)
      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

      public static MeasureType parse(String value)
      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

      public String toString()
      Returns the string representation of the measure value, formatted to at least four decimal places.
      Overrides:
      toString in class Object
      Returns:
      the string representation of the measure value.
    • getValue

      public BigDecimal getValue()
      Retrieves the current decimal value of the measure.
      Returns:
      the decimal value of the measure as a BigDecimal.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • value

      public BigDecimal value()
      Retrieves the current value of the measure.
      Returns:
      the decimal value of the measure as a BigDecimal.