Package com.example.bot
Class BaseBotWorker
java.lang.Object
com.example.bot.BaseBotWorker
- All Implemented Interfaces:
BotWorker
The BaseBotWorker class implements the BotWorker interface for managing bots in the chat application.
-
Constructor Summary
ConstructorsConstructorDescriptionBaseBotWorker
(StreamIO streamIO, TransportFactory transportFactory) Constructs a BaseBotWorker with the specified StreamIO and TransportFactory. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.
-
Constructor Details
-
BaseBotWorker
Constructs a BaseBotWorker with the specified StreamIO and TransportFactory.- Parameters:
streamIO
- the StreamIO object for input-output processingtransportFactory
- 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. -
startSendMessage
public void startSendMessage(int timerSendMessage, int intervalSend) Start sending messages with a specified timer and interval for sending messages.- Specified by:
startSendMessage
in interfaceBotWorker
- Parameters:
timerSendMessage
- the timer for sending messagesintervalSend
- the interval between message sends
-
removeBots
public void removeBots(int intervalExit) Remove bots from the server at a specified interval.- Specified by:
removeBots
in interfaceBotWorker
- Parameters:
intervalExit
- the interval for removing bots
-