java.lang.Object
de.powerstat.validation.values.Hours
- All Implemented Interfaces:
IValueObject
,Comparable<Hours>
Hours.
Not DSGVO relevant.
TODO min, max
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd other hours to this hours.int
Compare with another object.divide
(long divisor) Divide hours by a divisor.boolean
Is equal with another object.int
hashCode()
Calculate hash code.long
Returns the value of this BFPONumber as a long.modulo
(long divisor) Floor modulo hours by a divisor.multiply
(long multiplier) Multiply hours with a multiplier.static Hours
of
(long hours) Hours factory.static Hours
Hours factory.Returns the value of this BFPONumber as a String.Subtract other hours from this hours.toString()
Returns the string representation of this Hours.
-
Field Details
-
hours
private final long hoursHours.
-
-
Constructor Details
-
Hours
private Hours(long hours) Constructor.- Parameters:
hours
- Hours 0-..- Throws:
IndexOutOfBoundsException
- When the hours is less than 0
-
-
Method Details
-
of
Hours factory.- Parameters:
hours
- Hours 0-..- Returns:
- Hours object
-
of
Hours factory.- Parameters:
value
- Hours 0-.. string- Returns:
- Hours object
-
longValue
public long longValue()Returns the value of this BFPONumber as a long.- Returns:
- The numeric value represented by this object after conversion to type long.
-
stringValue
Returns the value of this BFPONumber 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 Hours. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "Hours[hours=1]" -
compareTo
Compare with another object.- Specified by:
compareTo
in interfaceComparable<Hours>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-
add
Add other hours to this hours.- Parameters:
other
- Other hours to add to this hours- Returns:
- New hours after adding other hours to this hours
- Throws:
ArithmeticException
- In case of an overflow
-
subtract
Subtract other hours from this hours.- Parameters:
other
- Other hours to subtract from this one- Returns:
- Absolute new hours after subtracting other hours from this hours
-
multiply
Multiply hours with a multiplier.- Parameters:
multiplier
- Multiplier to multiply with- Returns:
- New hours that is a multiplication of this hours with the multiplier
- Throws:
ArithmeticException
- In case of an overflow
-
divide
Divide hours 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 hours by a divisor.- Parameters:
divisor
- Divisor to divide by- Returns:
- The floor modulus Hours - (floorDiv(Hours, divisor) * divisor)
- Throws:
ArithmeticException
- In case the divisor is 0.
-