java.lang.Object
de.powerstat.validation.values.Millisecond
- All Implemented Interfaces:
IValueObject
,Comparable<Millisecond>
Millisecond.
Not DSGVO relevant.
TODO Listener
TODO min, max
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd
(Milliseconds milliseconds) Add milliseconds to this millisecond.int
compareTo
(Millisecond obj) Compare with another object.Decrement this millisecond.boolean
Is equal with another object.int
hashCode()
Calculate hash code.Increment this millisecond.int
intValue()
Returns the value of this Millisecond as an int.static Millisecond
of
(int millisecond) Millisecond factory.static Millisecond
Millisecond factory.Returns the value of this Millisecond as an String.subtract
(Milliseconds milliseconds) Subtract milliseconds from this millisecond.toString()
Returns the string representation of this Millisecond.
-
Field Details
-
OVERFLOW
Overflow constant.- See Also:
-
UNDERFLOW
Underflow constant.- See Also:
-
millisecond
private final int millisecondMilliseond.
-
-
Constructor Details
-
Millisecond
private Millisecond(int millisecond) Constructor.- Parameters:
millisecond
- Millisecond 0-999- Throws:
IndexOutOfBoundsException
- When the milliseond is less than 0 or greater than 999
-
-
Method Details
-
of
Millisecond factory.- Parameters:
millisecond
- Millisecond 0-999- Returns:
- Millisecond object
-
of
Millisecond factory.- Parameters:
value
- Millisecond string 0-999- Returns:
- Millisecond object
-
intValue
public int intValue()Returns the value of this Millisecond as an int.- Returns:
- The numeric value represented by this object after conversion to type int (0-999).
-
stringValue
Returns the value of this Millisecond as an String.- Specified by:
stringValue
in interfaceIValueObject
- Returns:
- The numeric value represented by this object after conversion to type String (0-999).
-
hashCode
public int hashCode()Calculate hash code. -
equals
Is equal with another object. -
toString
Returns the string representation of this Millisecond. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "Millisecond[millisecond=0]" -
compareTo
Compare with another object.- Specified by:
compareTo
in interfaceComparable<Millisecond>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-
add
Add milliseconds to this millisecond.- Parameters:
milliseconds
- Milliseconds to add to this millisecond- Returns:
- New millisecond after adding the milliseconds to this millisecond
- Throws:
ArithmeticException
- In case of an overflow
-
subtract
Subtract milliseconds from this millisecond.- Parameters:
milliseconds
- Milliseconds to subtract from this millisecond- Returns:
- New millisecond after subtracting milliseconds from this millisecond
- Throws:
ArithmeticException
- In case of an underflow
-
increment
Increment this millisecond.- Returns:
- New millisecond after incrementing this millisecond
- Throws:
ArithmeticException
- In case of an overflow
-
decrement
Decrement this millisecond.- Returns:
- New millisecond after decrement this millisecond
- Throws:
ArithmeticException
- In case of an overflow
-