Class Percent

All Implemented Interfaces:
Serializable, Comparable<PrmNumber>

public class Percent extends PrmNumber
This value type is used to define a percent value. One-hundred percent (100%) is represented by 1.0, 25% is represented by 0.25, etc.
See Also:
  • Field Details

    • ZERO_PERCENT

      public static final Percent ZERO_PERCENT
      0.0%
    • MAX_PERCENT

      public static final Percent MAX_PERCENT
      Maximum value
    • HUNDRED_PERCENT

      public static final Percent HUNDRED_PERCENT
      100.0%
    • MIN_PERCENT

      public static final Percent MIN_PERCENT
      Minimum Value
  • Constructor Details

    • Percent

      public Percent(double d)
      Constructs a Percent object with a given percent value in double format. Note that one-hundred percent (100%) is represented by 1.0, 25% is represented by 0.25, etc.
      Parameters:
      d - the percent value
    • Percent

      public Percent(Number n)
      Constructs a Percent object with a given percent value in Number format. Note that one-hundred percent (100%) is represented by 1.0, 25% is represented by 0.25, etc.
      Parameters:
      n - the percent value
  • Method Details

    • compareTo

      public int compareTo(PrmNumber obj)
      Compares two Percent objects.
      Specified by:
      compareTo in interface Comparable<PrmNumber>
      Overrides:
      compareTo in class PrmNumber
      Parameters:
      obj - the Object to be compared.
      Returns:
      the value 0 if the argument is a Percent numerically equal to this Percent; a value less than 0 if the argument is a Percent numerically greater than this Percent, or if the argument is not a Percent; and a value greater than 0 if the argument is a Percent numerically less than this Percent.