Record Class Stopwatch
java.lang.Object
java.lang.Record
net.minecraft.world.Stopwatch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longThe field for theaccumulatedElapsedTimerecord component.private final longThe field for thecreationTimerecord component. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the value of theaccumulatedElapsedTimerecord component.longReturns the value of thecreationTimerecord component.longelapsedMilliseconds(long currentTime) doubleelapsedSeconds(long currentTime) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
creationTime
private final long creationTimeThe field for thecreationTimerecord component. -
accumulatedElapsedTime
private final long accumulatedElapsedTimeThe field for theaccumulatedElapsedTimerecord component.
-
-
Constructor Details
-
Stopwatch
public Stopwatch(long creationTime) -
Stopwatch
public Stopwatch(long creationTime, long accumulatedElapsedTime) Creates an instance of aStopwatchrecord class.- Parameters:
creationTime- the value for thecreationTimerecord componentaccumulatedElapsedTime- the value for theaccumulatedElapsedTimerecord component
-
-
Method Details
-
elapsedMilliseconds
public long elapsedMilliseconds(long currentTime) -
elapsedSeconds
public double elapsedSeconds(long currentTime) -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
creationTime
public long creationTime()Returns the value of thecreationTimerecord component.- Returns:
- the value of the
creationTimerecord component
-
accumulatedElapsedTime
public long accumulatedElapsedTime()Returns the value of theaccumulatedElapsedTimerecord component.- Returns:
- the value of the
accumulatedElapsedTimerecord component
-