Class NegotiationExecutor
java.lang.Object
com.tnsai.coordination.negotiation.NegotiationExecutor
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 Summary
ConstructorsConstructorDescriptionCreates an executor with built-in protocols registered. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(NegotiationListener listener) Adds a negotiation listener.execute(List<com.tnsai.agents.Agent> parties, NegotiationConfig config) Executes a negotiation using the protocol matching the config type.getProtocol(com.tnsai.annotations.Coordination.NegotiationType type) Returns the registered protocol for the given type, or empty.voidregister(NegotiationProtocol protocol) Registers a protocol.voidremoveListener(NegotiationListener listener) Removes a negotiation listener.
-
Constructor Details
-
NegotiationExecutor
public NegotiationExecutor()Creates an executor with built-in protocols registered.
-
-
Method Details
-
register
Registers a protocol. If a protocol for the same type exists, it is replaced.- Parameters:
protocol- the protocol to register
-
execute
Executes a negotiation using the protocol matching the config type.- Parameters:
parties- agents participating in the negotiationconfig- negotiation configuration- Returns:
- the negotiation outcome
- Throws:
IllegalArgumentException- if no protocol registered for the type
-
addListener
Adds a negotiation listener. -
removeListener
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.
-