Class Barter
java.lang.Object
org.episteme.social.economics.Barter
- All Implemented Interfaces:
Serializable
Represents a direct exchange of property between two agents without using money.
Atomic transaction that validates ownership before execution.
* @version 1.1
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBarter(EconomicAgent agent1, Set<Resource> resources1, EconomicAgent agent2, Set<Resource> resources2) Initializes a barter contract. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Executes the exchange, updating both agents' belongings.
-
Constructor Details
-
Barter
public Barter(EconomicAgent agent1, Set<Resource> resources1, EconomicAgent agent2, Set<Resource> resources2) Initializes a barter contract.- Parameters:
agent1- first participantresources1- resources offered by agent1agent2- second participantresources2- resources offered by agent2- Throws:
IllegalArgumentException- if ownership is not verified
-
-
Method Details
-
getAgent1
-
getResources1
-
getAgent2
-
getResources2
-
execute
public void execute()Executes the exchange, updating both agents' belongings.
-