Class Trade

java.lang.Object
org.episteme.social.economics.Trade

public class Trade extends Object
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 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 agent
      agent1Resources - resources from agent 1 (must be owned by them)
      pricePaidBy1To2 - monetary compensation from 1 to 2
      economicAgent2 - the second agent
      agent2Resources - resources from agent 2 (must be owned by them)
      Throws:
      NullPointerException - if any argument is null
      IllegalArgumentException - if agents do not own the specified resources
  • Method Details

    • getEconomicAgent1

      public EconomicAgent getEconomicAgent1()
      Returns the first participant.
      Returns:
      agent 1
    • getAgent1Resources

      public Set<Resource> getAgent1Resources()
      Returns an unmodifiable view of resources from agent 1.
      Returns:
      resources from agent 1
    • getPricePaidBy1To2

      public Money getPricePaidBy1To2()
      Returns the monetary compensation from agent 1 to agent 2.
      Returns:
      the price
    • getEconomicAgent2

      public EconomicAgent getEconomicAgent2()
      Returns the second participant.
      Returns:
      agent 2
    • getAgent2Resources

      public Set<Resource> getAgent2Resources()
      Returns an unmodifiable view of resources from agent 2.
      Returns:
      resources from agent 2
    • tradeResources

      public void tradeResources()
      Executes the trade, transferring resources and money between agents.