jfreerails.controller
Class FinancialDataGatherer

java.lang.Object
  extended by jfreerails.world.top.TransactionAggregator
      extended by jfreerails.controller.FinancialDataGatherer

public class FinancialDataGatherer
extends TransactionAggregator

Gathers the financial data for a company.

Author:
Luke, smackay

Field Summary
private  int bonds
           
private  int playerID
           
private  int[] stockInRRs
           
private  int[] stockInThisRRs
           
private  int totalShares
           
 
Fields inherited from class jfreerails.world.top.TransactionAggregator
monetaryTotals, principal, runningTotal, w
 
Constructor Summary
FinancialDataGatherer(ReadOnlyWorld w, FreerailsPrincipal principal)
           
 
Method Summary
 int[] bondInterestRates()
           
 boolean canBuyStock()
           
 boolean canIssueBond()
           
 void changeStake(int stakeHolder, int deltaStock)
           
 void changeTreasuryStock(int deltaStock)
           
protected  boolean condition(int transactionID)
          Returns true if we should count the specified transactions.
 int getBonds()
           
 int[] getStockInRRs()
           
 int[] getStockInThisRRs()
           
protected  void incrementRunningTotal(int transactionID)
           
 Money netWorth()
           
 int nextBondInterestRate()
           
protected  void setTotalsArrayLength(int length)
          Creates a new array with the specified length to store monetary totals and sets the running total to zero.
 int sharesHeldByPublic()
           
protected  void storeRunningTotal(int timeIndex)
          Stores the current running total in the totals array at the specified position.
 boolean thisRRHasStakeIn(int otherReId)
           
 int totalShares()
          Returns The number of open Shares
 int treasuryStock()
          Returns the number of stock in the Treasury
 
Methods inherited from class jfreerails.world.top.TransactionAggregator
calculateValue, calculateValues, getTimes, setTimes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

totalShares

private int totalShares

playerID

private final int playerID

bonds

private int bonds

stockInRRs

private int[] stockInRRs

stockInThisRRs

private int[] stockInThisRRs
Constructor Detail

FinancialDataGatherer

public FinancialDataGatherer(ReadOnlyWorld w,
                             FreerailsPrincipal principal)
Method Detail

incrementRunningTotal

protected void incrementRunningTotal(int transactionID)
Overrides:
incrementRunningTotal in class TransactionAggregator

setTotalsArrayLength

protected void setTotalsArrayLength(int length)
Description copied from class: TransactionAggregator
Creates a new array with the specified length to store monetary totals and sets the running total to zero. Subclasses that aggregate other quantities should override this method and create the appropriate arrays.

Overrides:
setTotalsArrayLength in class TransactionAggregator

storeRunningTotal

protected void storeRunningTotal(int timeIndex)
Description copied from class: TransactionAggregator
Stores the current running total in the totals array at the specified position.

Overrides:
storeRunningTotal in class TransactionAggregator

changeTreasuryStock

public void changeTreasuryStock(int deltaStock)

changeStake

public void changeStake(int stakeHolder,
                        int deltaStock)

canIssueBond

public boolean canIssueBond()

canBuyStock

public boolean canBuyStock()

nextBondInterestRate

public int nextBondInterestRate()

bondInterestRates

public int[] bondInterestRates()

treasuryStock

public int treasuryStock()
Returns the number of stock in the Treasury


totalShares

public int totalShares()
Returns The number of open Shares


sharesHeldByPublic

public int sharesHeldByPublic()

thisRRHasStakeIn

public boolean thisRRHasStakeIn(int otherReId)

netWorth

public Money netWorth()

condition

protected boolean condition(int transactionID)
Description copied from class: TransactionAggregator
Returns true if we should count the specified transactions.

Specified by:
condition in class TransactionAggregator

getStockInThisRRs

public int[] getStockInThisRRs()

getStockInRRs

public int[] getStockInRRs()

getBonds

public int getBonds()