Class IdGen

java.lang.Object
net.targetr.rc.IdGen

public class IdGen extends Object
Generates new IDs for rooms and clients.
Author:
Dr Michael Gardiner
  • Constructor Details

    • IdGen

      public IdGen()
      Constructs a new IdGen.
  • Method Details

    • createClientId

      public static String createClientId()
      Generates a new random client ID. The ID format is XXXXXXXX where X represents a character from the allowed set.
      Returns:
      a new randomly generated string representing a client ID
    • createRoomId

      public static String createRoomId()
      Generates a new random room ID. The ID format is XXXX-XXXX where X represents a character from the allowed set.
      Returns:
      a new randomly generated string representing a room ID
    • isValidRoomId

      public static boolean isValidRoomId(String id)
      Validates whether a given string is a correctly formatted room ID.
      Parameters:
      id - the string to validate
      Returns:
      true if the ID matches the expected room ID format and contains only valid characters, false otherwise
    • isValidClientId

      public static boolean isValidClientId(String id)
      Validates whether a given string is a correctly formatted client ID.
      Parameters:
      id - the string to validate
      Returns:
      true if the ID matches the expected client ID format and contains only valid characters, false otherwise