Class PingResponse

java.lang.Object
org.kobe.xbot.Utilities.Entities.PingResponse

public class PingResponse extends Object
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 Details

    • PingResponse

      public PingResponse(boolean success, long roundTripNanoSeconds)
      Constructor for initializing the PingResponse.
      Parameters:
      success - Whether the ping was successful or not
      roundTripNanoSeconds - 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

      public String 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.

      Overrides:
      toString in class Object
      Returns:
      A string representing the success and round trip time