java.lang.Object
de.powerstat.validation.values.Minutes
All Implemented Interfaces:
IValueObject, Comparable<Minutes>

public final class Minutes extends Object implements Comparable<Minutes>, IValueObject
Minutes. Not DSGVO relevant. TODO min, max
  • Field Details

    • minutes

      private final long minutes
      Minutes.
  • Constructor Details

    • Minutes

      private Minutes(long minutes)
      Constructor.
      Parameters:
      minutes - Minutes 0-..
      Throws:
      IndexOutOfBoundsException - When the minutes is less than 0
  • Method Details

    • of

      public static Minutes of(long minutes)
      Minutes factory.
      Parameters:
      minutes - Minutes 0-..
      Returns:
      Minutes object
    • of

      public static Minutes of(String value)
      Minutes factory.
      Parameters:
      value - Minutes 0-.. string
      Returns:
      Minutes object
    • longValue

      public long longValue()
      Returns the value of this Minutes as a long.
      Returns:
      The numeric value represented by this object after conversion to type long.
    • stringValue

      public String stringValue()
      Returns the value of this Minutes as a String.
      Specified by:
      stringValue in interface IValueObject
      Returns:
      The numeric value represented by this object after conversion to type String.
    • hashCode

      public int hashCode()
      Calculate hash code.
      Overrides:
      hashCode in class Object
      Returns:
      Hash
      See Also:
    • equals

      public boolean equals(Object obj)
      Is equal with another object.
      Overrides:
      equals in class Object
      Parameters:
      obj - Object
      Returns:
      true when equal, false otherwise
      See Also:
    • toString

      public String toString()
      Returns the string representation of this Minutes. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "Minutes[minutes=1]"
      Overrides:
      toString in class Object
      Returns:
      String representation of this Minutes
      See Also:
    • compareTo

      public int compareTo(Minutes obj)
      Compare with another object.
      Specified by:
      compareTo in interface Comparable<Minutes>
      Parameters:
      obj - Object to compare with
      Returns:
      0: equal; 1: greater; -1: smaller
      See Also:
    • add

      public Minutes add(Minutes other)
      Add other minutes to this minutes.
      Parameters:
      other - Other minutes to add to this minutes
      Returns:
      New minutes after adding other minutes to this minutes
      Throws:
      ArithmeticException - In case of an overflow
    • subtract

      public Minutes subtract(Minutes other)
      Subtract other minutes from this minutes.
      Parameters:
      other - Other minutes to subtract from this one
      Returns:
      Absolute new minutes after subtracting other minutes from this minutes
    • multiply

      public Minutes multiply(long multiplier)
      Multiply minutes with a multiplier.
      Parameters:
      multiplier - Multiplier to multiply with
      Returns:
      New minutes that is a multiplication of this minutes with the multiplier
      Throws:
      ArithmeticException - In case of an overflow
    • divide

      public Minutes divide(long divisor)
      Divide minutes by a divisor.
      Parameters:
      divisor - Divisor to divide by
      Returns:
      The largest (closest to positive infinity) long value that is less than or equal to the algebraic quotient.
      Throws:
      ArithmeticException - In case the divisor is 0.
    • modulo

      public Minutes modulo(long divisor)
      Floor modulo minutes by a divisor.
      Parameters:
      divisor - Divisor to divide by
      Returns:
      The floor modulus Minutes - (floorDiv(Minutes, divisor) * divisor)
      Throws:
      ArithmeticException - In case the divisor is 0.