Skip to content

AbstractCountry

maxrev17 edited this page Jun 6, 2012 · 17 revisions

The AbstractCountry class should be extended to provide individual countries with different behaviours. It contains the shared functionality of all countries and has the correct data member variables for storing common country parameters such as land area. See below for a comprehensive breakdown of member data and member functions with descriptions of behaviours.


To-Do:

  • CarbonAbsorptionHandler - return and argument types need to be made uniform accross git branches i.e. long investment often still referred to as double - this documentation states the correct type - the code may need adjusting.

Useful Links:


Data Members:

final protected String ISO;					//ISO 3166-1 alpha-3

final protected double landArea;
protected double 	arableLandArea;

protected long 		carbonOutput; 				// In tons of carbon dioxide
protected long 		carbonOffset;				// In tons of carbon
protected long		emissionTarget;				// Required tonnes of carbon to be produced  

protected double 	GDP;						// Need to decide a unit
protected double 	GDPRate;
protected long		energyOutput;				// In tons of carbon equivalence
protected float 	availableToSpend;			// Initially derived from GDP then scaled differently

protected double	carbonEmission
protected Map < Integer, Double >	carbonEmissionReports

protected TradeProtocl 				tradeProtocol // Trade network interface
protected Set < PublicOffer >		offers			
protected CarbonReductionHandler 	carbonReductionHandler;
protected CarbonAbsorptionHandler 	carbonAbsorptionHandler;

AbstractCountry

Extends AbstractParticipant class of presage 2. NB: getters exist for all member variables.

Member Functions:

  • Constructor: returns an object of the class which extends AbstractClass

      public AbstractCountry(UUID id, String name, String ISO, double landArea, double arableLandArea, double GDP,
      			double GDPRate, float availableToSpend, long emissionsTarget, long carbonOffset,
      			long energyOutput, long carbonOutput) 
    
  • processInput: (overridden) Takes input and processes it - someone help me out here :p

      abstract protected void processInput(Input input);
    
  • initialise: (overridden) Uses super on the parent class to initialise the country object

      public void initialise()
    
  • execute: (overridden) Uses super on the parent class and executes monitoring tax code

      public void execute()
    
  • getSharedState: Adds carbon reporting service to shared state and returns object

      protected Set < ParticipantSharedState > getSharedState()
    
  • getCarbonEmissionReports: returns the carbon emission reports of the country

       public Double reportCarbonEmission(Time t)
    
  • addToReports: Private setter for personal reports - simulation time and emissions recorded returns reports

      private Map < Integer, Double > addToReports(Time simTime, Double emission)
    
  • reportCarbonEmission: Report carbon emissions. Records time of reporting. Updates personal record before calculating emissions to be reported to environment. Decides whether to 'cheat'

      public Double reportCarbonEmission(Time t)
    
  • reduceEnergyOutput: Reduces energyOutput and carbonOutput. Limit carbonOutput without financial cost although GDP growth limited by reduction in energyOutput.

      public void reduceEnergyOutput (long amount) throws IllegalArgumentException
    
  • calculateCostOfInvestingInCarbonIndustry: returns the cost of investing in carbon industry

      protected long calculateCostOfInvestingInCarbonIndustry (long carbon)
    
  • calculateCarbonIndustryGrowth: returns the increase of carbon output

      protected long calculateCarbonIndustryGrowth (long cost)
    
  • investInCarbonIndustry: invests in carbon industry carbon + energy o/p of country go up. Pass desired increase in carbon output

      protected void investInCarbonIndustry(long carbon)
    
  • getCash: Returns the cash available - calculated using GDP and GameConst class constant PERCENTAGE_OF_GDP

      public Double getCash()		
    
  • calculateGDPRate: (event listener) Given the end value of a time cycle, calculates the GDP rate (%) of the ...

      public void calculateGDPRate(EndOfTimeCycle e)
    



private final class CarbonReductionHandler

Houses functions concerned with dirty industry and its reduction

  • Member Data:

      // n/a
    
  • Member Functions:

    • getCost: returns the cost of investment required to reduce dirty industry

        public final double getCost(double carbonOutputChange)
      
    • getCarbonOutputChange: returns the reduction of carbon output

        public final double getCarbonOutputChange(long cost)
      
    • invest: executes carbon reduction investment

        public final void invest(long investment) throws Exception	
      



private final class CarbonAbsorptionHandler

Houses functions concerned with obtaining and earning carbon credits

  • Member Data:

    // n/a

  • Member Functions:

    • getCost: returns the cost of investment required to obtain a given number of carbon credits

        public double getCost(long carbonOffset)
      
    • getCarbonOffset: returns number of carbon credits earned for a given investment

        public long getCarbonCredits(long investment)
      
    • getBlockCost: returns cost of making an area of land a carbon reduction investment

        public long getBlockCost(double landArea)
      
    • execute: executes carbon absorption investment

        public void execute(long investment) throws Exception