Record Class SwarmResult.AgentContribution
java.lang.Object
java.lang.Record
com.tnsai.coordination.groups.swarm.SwarmResult.AgentContribution
- Record Components:
agentId- agent identifieragentName- agent nameoutput- agent's outputsuccess- whether agent succeededdurationMs- execution timepheromoneDeposits- pheromones deposited
- Enclosing class:
SwarmResult
public static record SwarmResult.AgentContribution(String agentId, String agentName, String output, boolean success, long durationMs, int pheromoneDeposits)
extends Record
Individual agent's contribution to the swarm task.
-
Constructor Summary
ConstructorsConstructorDescriptionAgentContribution(String agentId, String agentName, String output, boolean success, long durationMs, int pheromoneDeposits) Creates an instance of aAgentContributionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionagentId()Returns the value of theagentIdrecord component.Returns the value of theagentNamerecord component.longReturns the value of thedurationMsrecord component.final booleanIndicates whether some other object is "equal to" this one.Creates a failed contribution.final inthashCode()Returns a hash code value for this object.output()Returns the value of theoutputrecord component.intReturns the value of thepheromoneDepositsrecord component.booleansuccess()Returns the value of thesuccessrecord component.Creates a successful contribution.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
AgentContribution
public AgentContribution(String agentId, String agentName, String output, boolean success, long durationMs, int pheromoneDeposits) Creates an instance of aAgentContributionrecord class.- Parameters:
agentId- the value for theagentIdrecord componentagentName- the value for theagentNamerecord componentoutput- the value for theoutputrecord componentsuccess- the value for thesuccessrecord componentdurationMs- the value for thedurationMsrecord componentpheromoneDeposits- the value for thepheromoneDepositsrecord component
-
-
Method Details
-
success
public static SwarmResult.AgentContribution success(String agentId, String agentName, String output, long durationMs, int deposits) Creates a successful contribution. -
failure
public static SwarmResult.AgentContribution failure(String agentId, String agentName, String error, long durationMs) Creates a failed contribution. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
agentId
Returns the value of theagentIdrecord component.- Returns:
- the value of the
agentIdrecord component
-
agentName
Returns the value of theagentNamerecord component.- Returns:
- the value of the
agentNamerecord component
-
output
Returns the value of theoutputrecord component.- Returns:
- the value of the
outputrecord component
-
success
public boolean success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-
durationMs
public long durationMs()Returns the value of thedurationMsrecord component.- Returns:
- the value of the
durationMsrecord component
-
pheromoneDeposits
public int pheromoneDeposits()Returns the value of thepheromoneDepositsrecord component.- Returns:
- the value of the
pheromoneDepositsrecord component
-