java.lang.Object
de.powerstat.validation.values.Minutes
- All Implemented Interfaces:
IValueObject
,Comparable<Minutes>
Minutes.
Not DSGVO relevant.
TODO min, max
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd other minutes to this minutes.int
Compare with another object.divide
(long divisor) Divide minutes by a divisor.boolean
Is equal with another object.int
hashCode()
Calculate hash code.long
Returns the value of this Minutes as a long.modulo
(long divisor) Floor modulo minutes by a divisor.multiply
(long multiplier) Multiply minutes with a multiplier.static Minutes
of
(long minutes) Minutes factory.static Minutes
Minutes factory.Returns the value of this Minutes as a String.Subtract other minutes from this minutes.toString()
Returns the string representation of this Minutes.
-
Field Details
-
minutes
private final long minutesMinutes.
-
-
Constructor Details
-
Minutes
private Minutes(long minutes) Constructor.- Parameters:
minutes
- Minutes 0-..- Throws:
IndexOutOfBoundsException
- When the minutes is less than 0
-
-
Method Details
-
of
Minutes factory.- Parameters:
minutes
- Minutes 0-..- Returns:
- Minutes object
-
of
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
Returns the value of this Minutes as a String.- Specified by:
stringValue
in interfaceIValueObject
- Returns:
- The numeric value represented by this object after conversion to type String.
-
hashCode
public int hashCode()Calculate hash code. -
equals
Is equal with another object. -
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]" -
compareTo
Compare with another object.- Specified by:
compareTo
in interfaceComparable<Minutes>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-
add
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
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
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
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
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.
-