Record Class TeamResult
java.lang.Object
java.lang.Record
com.tnsai.coordination.groups.team.TeamResult
- Record Components:
taskId- task identifiersuccess- whether execution succeededoutput- final output (aggregated result)memberOutputs- individual member outputsformation- formation usedstartedAt- execution start timecompletedAt- execution end timeerror- error message if failedmetadata- additional metadata
public record TeamResult(String taskId, boolean success, String output, Map<String,TeamResult.MemberOutput> memberOutputs, TeamFormation formation, Instant startedAt, Instant completedAt, String error, Map<String,Object> metadata)
extends Record
Result of a team task execution.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordIndividual member's output. -
Constructor Summary
ConstructorsConstructorDescriptionTeamResult(String taskId, boolean success, String output, Map<String, TeamResult.MemberOutput> memberOutputs, TeamFormation formation, Instant startedAt, Instant completedAt, String error, Map<String, Object> metadata) Creates an instance of aTeamResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecompletedAtrecord component.final booleanIndicates whether some other object is "equal to" this one.error()Returns the value of theerrorrecord component.static TeamResultfailure(String taskId, String error, Map<String, TeamResult.MemberOutput> memberOutputs, TeamFormation formation, Instant startedAt) Creates a failed result.Returns the value of theformationrecord component.Gets execution duration.longGets count of failed member outputs.getMemberOutput(String agentId) Gets the output from a specific member.longGets count of successful member outputs.final inthashCode()Returns a hash code value for this object.Returns the value of thememberOutputsrecord component.metadata()Returns the value of themetadatarecord component.output()Returns the value of theoutputrecord component.Returns the value of thestartedAtrecord component.booleansuccess()Returns the value of thesuccessrecord component.static TeamResultsuccess(String taskId, String output, Map<String, TeamResult.MemberOutput> memberOutputs, TeamFormation formation, Instant startedAt) Creates a successful result.taskId()Returns the value of thetaskIdrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TeamResult
public TeamResult(String taskId, boolean success, String output, Map<String, TeamResult.MemberOutput> memberOutputs, TeamFormation formation, Instant startedAt, Instant completedAt, String error, Map<String, Object> metadata) Creates an instance of aTeamResultrecord class.- Parameters:
taskId- the value for thetaskIdrecord componentsuccess- the value for thesuccessrecord componentoutput- the value for theoutputrecord componentmemberOutputs- the value for thememberOutputsrecord componentformation- the value for theformationrecord componentstartedAt- the value for thestartedAtrecord componentcompletedAt- the value for thecompletedAtrecord componenterror- the value for theerrorrecord componentmetadata- the value for themetadatarecord component
-
-
Method Details
-
success
public static TeamResult success(String taskId, String output, Map<String, TeamResult.MemberOutput> memberOutputs, TeamFormation formation, Instant startedAt) Creates a successful result.- Parameters:
taskId- task IDoutput- aggregated outputmemberOutputs- member outputsformation- formation usedstartedAt- start time- Returns:
- successful result
-
failure
public static TeamResult failure(String taskId, String error, Map<String, TeamResult.MemberOutput> memberOutputs, TeamFormation formation, Instant startedAt) Creates a failed result.- Parameters:
taskId- task IDerror- error messagememberOutputs- partial member outputsformation- formation usedstartedAt- start time- Returns:
- failed result
-
getDuration
Gets execution duration.- Returns:
- duration
-
getSuccessCount
public long getSuccessCount()Gets count of successful member outputs.- Returns:
- success count
-
getFailureCount
public long getFailureCount()Gets count of failed member outputs.- Returns:
- failure count
-
getMemberOutput
Gets the output from a specific member.- Parameters:
agentId- agent ID- Returns:
- member output
-
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 '=='. -
taskId
Returns the value of thetaskIdrecord component.- Returns:
- the value of the
taskIdrecord component
-
success
public boolean success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-
output
Returns the value of theoutputrecord component.- Returns:
- the value of the
outputrecord component
-
memberOutputs
Returns the value of thememberOutputsrecord component.- Returns:
- the value of the
memberOutputsrecord component
-
formation
Returns the value of theformationrecord component.- Returns:
- the value of the
formationrecord component
-
startedAt
Returns the value of thestartedAtrecord component.- Returns:
- the value of the
startedAtrecord component
-
completedAt
Returns the value of thecompletedAtrecord component.- Returns:
- the value of the
completedAtrecord component
-
error
Returns the value of theerrorrecord component.- Returns:
- the value of the
errorrecord component
-
metadata
Returns the value of themetadatarecord component.- Returns:
- the value of the
metadatarecord component
-