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