Skip to content

Commit 19ea191

Browse files
committed
Fix
1 parent a8e95d1 commit 19ea191

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/java/com/thealgorithms/scheduling/MultiAgentScheduling.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,24 @@ public void addAgent(String agentName) {
4444
agents.putIfAbsent(agentName, new Agent(agentName));
4545
}
4646

47+
/**
48+
* Assign a task to a specific agent.
49+
*
50+
* @param agentName the name of the agent
51+
* @param task the task to be assigned
52+
*/
4753
public void assignTask(String agentName, String task) {
4854
Agent agent = agents.get(agentName);
4955
if (agent != null) {
5056
agent.addTask(task);
5157
}
5258
}
5359

60+
/**
61+
* Get the scheduled tasks for each agent.
62+
*
63+
* @return a map of agent names to their scheduled tasks
64+
*/
5465
public Map<String, List<String>> getScheduledTasks() {
5566
Map<String, List<String>> schedule = new HashMap<>();
5667
for (Agent agent : agents.values()) {

0 commit comments

Comments
 (0)