rails.game
Class TreasuryShareRound

java.lang.Object
  extended by rails.game.Round
      extended by rails.game.StockRound
          extended by rails.game.TreasuryShareRound
All Implemented Interfaces:
RoundI

public class TreasuryShareRound
extends StockRound

Author:
Erik Vos

Field Summary
(package private)  PublicCompanyI operatingCompany
           
(package private)  Player sellingPlayer
           
 
Fields inherited from class rails.game.StockRound
BOUGHT, companyBoughtThisTurnWrapper, currentPlayer, hasActed, hasSoldThisTurnBeforeBuying, numberOfPlayers, numPasses, playersThatSoldThisRound, SELL_BUY, SELL_BUY_OR_BUY_SELL, SELL_BUY_SELL, sellObligationLifted, sellPrices, sequenceRule, SOLD, startingPlayer
 
Fields inherited from class rails.game.Round
autopasses, bank, canRequestTurn, companyManager, gameManager, guiHints, hasRequestedTurn, ipo, log, mapManager, moveStack, playerManager, pool, possibleActions, scrapHeap, stockMarket, unavailable, wasInterrupted
 
Constructor Summary
TreasuryShareRound(GameManagerI aGameManager, RoundI parentRound)
          Constructor with the GameManager, will call super class (StockRound's) Constructor to initialize, and and other parameters used by the Treasury Share Round Class
 
Method Summary
 boolean buyShares(java.lang.String playerName, BuyCertificate action)
          Buying one or more single or double-share certificates (more is sometimes possible)
 boolean done(java.lang.String playerName, boolean hasAutopassed)
          The current Player passes or is done.
 PublicCompanyI getOperatingCompany()
           
 boolean mayCurrentPlayerBuyAnything()
          Can the current player do any buying?
 boolean mayCurrentPlayerSellAnything()
          Can the current player do any selling?
 boolean sellShares(SellShares action)
           
 void setBuyableCerts()
          Create a list of certificates that a player may buy in a Stock Round, taking all rules into account.
 boolean setPossibleActions()
          Default version, does nothing.
 void setSellableCerts()
          Create a list of certificates that the company may sell, taking all rules taken into account.
 void start()
           
 java.lang.String toString()
           
 
Methods inherited from class rails.game.StockRound
adjustSharePrice, checkAgainstHoldLimit, executeExchangeForShare, executeShareTransfer, finishRound, finishTurn, gameSpecificChecks, getBuyPrice, getCurrentPlayerIndex, getCurrentSellPrice, getHelp, getRoundName, getSharePriceRecipient, getStockRoundNumber, initPlayer, isPlayerOverLimits, isPlayerOverLimitsDetail, isSaleRecorded, isSellObligationLifted, maxAllowedNumberOfSharesToBuy, mayPlayerBuyCertificate, mayPlayerSellShareOfCompany, noSaleIfNotOperated, noSaleInFirstSR, process, processGameSpecificAction, recordSale, releaseCompanyShares, requestTurn, setCurrentPlayer, setGameSpecificActions, setNextPlayer, setPriority, setSellableShares, setSellObligationLifted, setSpecialActions, startCompany, useSpecialProperty
 
Methods inherited from class rails.game.Round
canCompanyOperateThisRound, canRequestTurn, certCountsAsSold, checkFlotation, exchangeTokens, floatCompany, getAutopasses, getCurrentPhase, getCurrentPlayer, getGameManager, getGameOption, getGameParameter, getGameParameterAsBoolean, getGameParameterAsInt, getNumberOfActivePlayers, getNumberOfPlayers, getPlayers, getRoundTypeForUI, getSoldPercentage, getSpecialProperties, hasAutopassed, pay, pay, requestTurn, resume, setAutopass, setCanRequestTurn, setCurrentPlayerIndex, setOperatingCompanies, setOperatingCompanies, transferCertificate, transferCertificates, wasInterrupted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sellingPlayer

Player sellingPlayer

operatingCompany

PublicCompanyI operatingCompany
Constructor Detail

TreasuryShareRound

public TreasuryShareRound(GameManagerI aGameManager,
                          RoundI parentRound)
Constructor with the GameManager, will call super class (StockRound's) Constructor to initialize, and and other parameters used by the Treasury Share Round Class

Parameters:
aGameManager - The GameManager Object needed to initialize the StockRound Class
operatingCompany - The PublicCompanyI Object that is selling shares
Method Detail

start

public void start()
Overrides:
start in class StockRound

mayCurrentPlayerSellAnything

public boolean mayCurrentPlayerSellAnything()
Description copied from class: StockRound
Can the current player do any selling?

Overrides:
mayCurrentPlayerSellAnything in class StockRound
Returns:
True if any selling is allowed.

mayCurrentPlayerBuyAnything

public boolean mayCurrentPlayerBuyAnything()
Description copied from class: StockRound
Can the current player do any buying?

Overrides:
mayCurrentPlayerBuyAnything in class StockRound
Returns:
True if any buying is allowed.

setPossibleActions

public boolean setPossibleActions()
Description copied from class: Round
Default version, does nothing. Subclasses should override this method with a real version.

Specified by:
setPossibleActions in interface RoundI
Overrides:
setPossibleActions in class StockRound

setBuyableCerts

public void setBuyableCerts()
Create a list of certificates that a player may buy in a Stock Round, taking all rules into account.

Overrides:
setBuyableCerts in class StockRound

setSellableCerts

public void setSellableCerts()
Create a list of certificates that the company may sell, taking all rules taken into account.
Note: old code that provides for ownership of presidencies of other companies has been retained, but not tested. This code will be needed for 1841.


buyShares

public boolean buyShares(java.lang.String playerName,
                         BuyCertificate action)
Buying one or more single or double-share certificates (more is sometimes possible)

Overrides:
buyShares in class StockRound
Parameters:
player - The player that wants to buy shares.
action - The executed action
Returns:
True if the certificates could be bought. False indicates an error.

sellShares

public boolean sellShares(SellShares action)
Overrides:
sellShares in class StockRound

done

public boolean done(java.lang.String playerName,
                    boolean hasAutopassed)
The current Player passes or is done.

Overrides:
done in class StockRound
Parameters:
player - Name of the passing player.
Returns:
False if an error is found.

getOperatingCompany

public PublicCompanyI getOperatingCompany()

toString

public java.lang.String toString()
Overrides:
toString in class StockRound