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