ImportExport Class Reference

The implementation of the ImportExport agent. More...

Inherits IBuyer, and ISeller.

Collaboration diagram for ImportExport:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void init (Sector pSector)
 Initialize the ImportExport agent.
void trade ()
 The ImportExport agent buy goods from firms in the economy and export those goods.
void account ()
 Calculate maxImport/ExportInPeriod for the next period and reset import/exportLeft.
void sell (double pQuantity)
 
See also:
ISeller.sell

double getPrice ()
 
See also:
ISeller.getPrice

double getInventory ()
 
See also:
ISeller.getInventory

Sector getProductionSector ()
 
See also:
ISeller.getProductionSector


Package Functions

 ImportExport (Foundation pFoundation, ImportExportInitValues pInitValues)
 The constructor of the ImportExport agent.

Package Attributes

double maxImportInPeriod
 The maximal units of goods that can be imported in this period.
double importLeft
 The number of units that can be imported at the actual time.
double maxExportInPeriod
 The maximal units of goods that can be exported in this period.
double exportLeft
 The number of units that can be exported at the actual time.

Classes

class  Probe


Detailed Description

The implementation of the ImportExport agent.

For each sector a single instance of this class exist. The agent buys and sells goods of the corresponding sector. He buys x units after all other agents have traded, where x is determined by parameters in ImportExportInitValues. He sells goods to a buyer in the case that the buyer couldn't satisfy his needs with the inventory from the observed firms.

Definition at line 37 of file ImportExport.java.


Constructor & Destructor Documentation

ImportExport ( Foundation  pFoundation,
ImportExportInitValues  pInitValues 
) [package]

The constructor of the ImportExport agent.

Parameters:
pFoundation The model foundation
pInitValues The init values of the ImportExport agent

Definition at line 163 of file ImportExport.java.

00163                                                                            {
00164     foundation = pFoundation;
00165     initValues = pInitValues;
00166   }


Member Function Documentation

void init ( Sector  pSector  ) 

Initialize the ImportExport agent.

It calculate the maximal import/export of the first period by multiplying a given coefficient with the initial production/consumption in the corresponding sector.

Parameters:
pSector An agent correspond to the sector pSector (it buys and sells goods of this sector).

Definition at line 177 of file ImportExport.java.

Referenced by Sector.init(), and ImportExport.init().

00177                                    {
00178     sector = pSector;
00179     maxImportInPeriod = sector.getInitProduction() *
00180       initValues.getInitialMaxImportAsOverallProductionFactorArray()[sector.getArrayIndex()];
00181     importLeft = maxImportInPeriod;
00182 
00183     maxExportInPeriod = sector.getInitConsumption() *
00184       initValues.getInitialMaxExportAsOverallProductionFactorArray()[sector.getArrayIndex()];
00185     exportLeft = maxExportInPeriod;
00186 
00187     probe.init();
00188 
00189     suppliers.init(foundation, this, pSector, initValues.getObservedSuppliersQuotient());
00190   }

void trade (  ) 

The ImportExport agent buy goods from firms in the economy and export those goods.

See also:
IBuyer.trade()

Implements IBuyer.

Definition at line 199 of file ImportExport.java.

00199                       {
00200     suppliers.updateSuppliers(Suppliers.SellerSet.EXCLUDE_IMPORT);
00201     //add supppliers in case of rationning
00202     suppliers.addSuppliers(exportLeft, Suppliers.SellerSet.EXCLUDE_IMPORT);
00203     // buy 
00204     final double lTrade = Math.min(exportLeft, suppliers.maxSupply());
00205     suppliers.buy(lTrade);
00206     exportLeft -= lTrade;
00207   }

void account (  ) 

Calculate maxImport/ExportInPeriod for the next period and reset import/exportLeft.

Definition at line 212 of file ImportExport.java.

00212                         {
00213     maxImportInPeriod *= initValues.getGrowthOfMaxImport();
00214     maxImportInPeriod= Math.max(maxImportInPeriod, sector.getOverallProduction() *
00215       initValues.getInitialMaxImportAsOverallProductionFactorArray()[sector.getArrayIndex()]);
00216     importLeft = maxImportInPeriod;
00217 
00218     maxExportInPeriod = sector.getOverallProduction() *
00219       initValues.getInitialMaxExportAsOverallProductionFactorArray()[sector.getArrayIndex()];
00220     exportLeft = maxExportInPeriod;
00221   }

void sell ( double  pQuantity  ) 

See also:
ISeller.sell

Implements ISeller.

Definition at line 227 of file ImportExport.java.

00227                                      {
00228     importLeft -= pQuantity;
00229   }

double getPrice (  ) 

See also:
ISeller.getPrice

Implements ISeller.

Definition at line 234 of file ImportExport.java.

00234                            {
00235     return sector.getStats().getMaxPrice() * 1.001;
00236   }

double getInventory (  ) 

See also:
ISeller.getInventory

Implements ISeller.

Definition at line 241 of file ImportExport.java.

Referenced by Suppliers.addSuppliers(), and Suppliers.findSuppliers().

00241                                {
00242     return importLeft;
00243   }

Sector getProductionSector (  ) 

See also:
ISeller.getProductionSector

Implements ISeller.

Definition at line 248 of file ImportExport.java.

00248                                       {
00249     return sector;
00250   } 


Member Data Documentation

double maxImportInPeriod [package]

The maximal units of goods that can be imported in this period.

Definition at line 121 of file ImportExport.java.

Referenced by ImportExport.account(), and ImportExport.init().

double importLeft [package]

The number of units that can be imported at the actual time.

This is equivalent to ImportExport.maxImportInPeriod less the already imported units in this period.

Definition at line 133 of file ImportExport.java.

Referenced by ImportExport.account(), ImportExport.getInventory(), ImportExport.init(), and ImportExport.sell().

double maxExportInPeriod [package]

The maximal units of goods that can be exported in this period.

Definition at line 140 of file ImportExport.java.

Referenced by ImportExport.account(), and ImportExport.init().

double exportLeft [package]

The number of units that can be exported at the actual time.

This is equivalent to ImportExport.maxExportedInPeriod less the already exported units in this period.

See also:
ImportExport.trade

Definition at line 154 of file ImportExport.java.

Referenced by ImportExport.account(), ImportExport.init(), and ImportExport.trade().


The documentation for this class was generated from the following file:
Generated on Tue Sep 14 11:11:49 2010 for lagom_generiC by  doxygen 1.5.4