Class NegotiationExecutor

java.lang.Object
com.tnsai.coordination.negotiation.NegotiationExecutor

public final class NegotiationExecutor extends Object
Orchestrator that resolves the appropriate NegotiationProtocol from a NegotiationConfig and executes the negotiation.

Supports registering custom protocols and notifying listeners.

Since:
0.0.2
  • Constructor Details

    • NegotiationExecutor

      public NegotiationExecutor()
      Creates an executor with built-in protocols registered.
  • Method Details

    • register

      public void register(NegotiationProtocol protocol)
      Registers a protocol. If a protocol for the same type exists, it is replaced.
      Parameters:
      protocol - the protocol to register
    • execute

      public NegotiationOutcome execute(List<com.tnsai.agents.Agent> parties, NegotiationConfig config)
      Executes a negotiation using the protocol matching the config type.
      Parameters:
      parties - agents participating in the negotiation
      config - negotiation configuration
      Returns:
      the negotiation outcome
      Throws:
      IllegalArgumentException - if no protocol registered for the type
    • addListener

      public void addListener(NegotiationListener listener)
      Adds a negotiation listener.
    • removeListener

      public void removeListener(NegotiationListener listener)
      Removes a negotiation listener.
    • getProtocol

      public Optional<NegotiationProtocol> getProtocol(com.tnsai.annotations.Coordination.NegotiationType type)
      Returns the registered protocol for the given type, or empty.