Class Trade
java.lang.Object
org.episteme.social.economics.Trade
Represents a commercial exchange between two economic agents.
A trade involves transferring sets of resources and a monetary payment.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
ConstructorsConstructorDescriptionTrade(EconomicAgent economicAgent1, Set<Resource> agent1Resources, Money pricePaidBy1To2, EconomicAgent economicAgent2, Set<Resource> agent2Resources) Creates a new Trade transaction. -
Method Summary
Modifier and TypeMethodDescriptionReturns an unmodifiable view of resources from agent 1.Returns an unmodifiable view of resources from agent 2.Returns the first participant.Returns the second participant.Returns the monetary compensation from agent 1 to agent 2.voidExecutes the trade, transferring resources and money between agents.
-
Constructor Details
-
Trade
public Trade(EconomicAgent economicAgent1, Set<Resource> agent1Resources, Money pricePaidBy1To2, EconomicAgent economicAgent2, Set<Resource> agent2Resources) Creates a new Trade transaction.- Parameters:
economicAgent1- the first agentagent1Resources- resources from agent 1 (must be owned by them)pricePaidBy1To2- monetary compensation from 1 to 2economicAgent2- the second agentagent2Resources- resources from agent 2 (must be owned by them)- Throws:
NullPointerException- if any argument is nullIllegalArgumentException- if agents do not own the specified resources
-
-
Method Details
-
getEconomicAgent1
-
getAgent1Resources
-
getPricePaidBy1To2
Returns the monetary compensation from agent 1 to agent 2.- Returns:
- the price
-
getEconomicAgent2
-
getAgent2Resources
-
tradeResources
public void tradeResources()Executes the trade, transferring resources and money between agents.
-