Package org.kobe.xbot.Utilities.Entities
Class PingResponse
java.lang.Object
org.kobe.xbot.Utilities.Entities.PingResponse
PingResponse - A class that encapsulates the result of a ping operation.
This class contains information about the success or failure of a ping, as well as the round-trip time in nanoseconds. It also provides a method to convert the round-trip time to milliseconds.
Author: Kobe Lei Version: 1.1
-
Constructor Summary
ConstructorsConstructorDescriptionPingResponse
(boolean success, long roundTripNanoSeconds) Constructor for initializing the PingResponse. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Gets the round trip time in milliseconds.long
Gets the round-trip time in nanoseconds.boolean
Gets the success status of the ping.toString()
Provides a formatted string representation of the PingResponse object.
-
Constructor Details
-
PingResponse
public PingResponse(boolean success, long roundTripNanoSeconds) Constructor for initializing the PingResponse.- Parameters:
success
- Whether the ping was successful or notroundTripNanoSeconds
- The round-trip time in nanoseconds
-
-
Method Details
-
isSuccess
public boolean isSuccess()Gets the success status of the ping.- Returns:
- true if the ping was successful, false otherwise
-
getRoundTripNanoSeconds
public long getRoundTripNanoSeconds()Gets the round-trip time in nanoseconds.- Returns:
- The round-trip time in nanoseconds
-
getRoundTripMilliseconds
public double getRoundTripMilliseconds()Gets the round trip time in milliseconds.- Returns:
- The round-trip time in milliseconds
-
toString
Provides a formatted string representation of the PingResponse object.If the round trip time is under one million nanoseconds, it is displayed in nanoseconds, otherwise in milliseconds.
-