Class BaseBotWorker

java.lang.Object
com.example.bot.BaseBotWorker
All Implemented Interfaces:
BotWorker

public class BaseBotWorker extends Object implements BotWorker
The BaseBotWorker class implements the BotWorker interface for managing bots in the chat application.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BaseBotWorker(StreamIO streamIO, TransportFactory transportFactory)
    Constructs a BaseBotWorker with the specified StreamIO and TransportFactory.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addBots(String ipServer, int portServer, int startPort, int countBot, int intervalCount)
    Add bots to the server with specified parameters.
    void
    removeBots(int intervalExit)
    Remove bots from the server at a specified interval.
    void
    startSendMessage(int timerSendMessage, int intervalSend)
    Start sending messages with a specified timer and interval for sending messages.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BaseBotWorker

      public BaseBotWorker(StreamIO streamIO, TransportFactory transportFactory)
      Constructs a BaseBotWorker with the specified StreamIO and TransportFactory.
      Parameters:
      streamIO - the StreamIO object for input-output processing
      transportFactory - the TransportFactory object for creating connections
  • Method Details

    • addBots

      public void addBots(String ipServer, int portServer, int startPort, int countBot, int intervalCount)
      Add bots to the server with specified parameters.
      Specified by:
      addBots in interface BotWorker
      Parameters:
      ipServer - the IP address of the server
      portServer - the port number of the server
      startPort - the starting port number for bots
      countBot - the number of bots to add
      intervalCount - the interval between adding bots
    • startSendMessage

      public void startSendMessage(int timerSendMessage, int intervalSend)
      Start sending messages with a specified timer and interval for sending messages.
      Specified by:
      startSendMessage in interface BotWorker
      Parameters:
      timerSendMessage - the timer for sending messages
      intervalSend - the interval between message sends
    • removeBots

      public void removeBots(int intervalExit)
      Remove bots from the server at a specified interval.
      Specified by:
      removeBots in interface BotWorker
      Parameters:
      intervalExit - the interval for removing bots