|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrails.game.StartItem
public class StartItem
Each object of this class represents a "start packet item", which consist of one or two certificates. The whole start packet must be bought before the stock rounds can start.
During XML parsing, only the certificate name and other attributes are saved. The certificate objects are linked to in the later initialisation step.
Field Summary | |
---|---|
static int |
AUCTIONED
|
protected MoneyModel |
basePrice
|
static int |
BIDDABLE
|
protected MoneyModel[] |
bids
|
static int |
BUYABLE
|
protected int |
column
|
protected int |
index
|
protected IntegerState |
lastBidderIndex
|
protected static org.apache.log4j.Logger |
log
|
protected MoneyModel |
minimumBid
|
protected java.lang.String |
name
|
protected java.lang.String |
name2
|
static int |
NEEDS_SHARE_PRICE
|
protected int |
numberOfPlayers
|
protected java.util.List<Player> |
players
|
protected boolean |
president
|
protected boolean |
president2
|
protected Certificate |
primary
|
protected int |
row
|
protected Certificate |
secondary
|
static int |
SELECTABLE
|
static int |
SOLD
|
protected static java.util.Map<java.lang.String,StartItem> |
startItemMap
|
protected IntegerState |
status
Status of the start item (buyable? biddable?) regardless whether the current player has the amount of (unblocked) cash to buy it or to bid on it. |
static java.lang.String[] |
statusName
|
protected java.lang.String |
type
|
protected java.lang.String |
type2
|
static int |
UNAVAILABLE
|
Constructor Summary | |
---|---|
StartItem(java.lang.String name,
java.lang.String type,
int basePrice,
int index,
boolean president)
The constructor, taking the properties of the "primary" (often teh only) certificate. |
Method Summary | |
---|---|
protected PublicCompanyI |
checkNeedForPriceSetting(Certificate certificate)
If a start item component a President's certificate that needs price setting, return the name of thecompany for which the price must be set. |
boolean |
equals(StartItem item)
|
int |
getBasePrice()
Get the start item base price. |
ModelObject |
getBasePriceModel()
|
int |
getBid()
Get the currently highest bid amount. |
int |
getBid(Player player)
Get the highest bid done so far by a particular player. |
Player |
getBidder()
Get the highest bidder so far. |
int |
getBidders()
Return the total number of players that has done bids so far on this item. |
ModelObject |
getBidForPlayerModel(int index)
|
static StartItem |
getByName(java.lang.String name)
|
int |
getColumn()
Get the column number. |
int |
getIndex()
|
int |
getMinimumBid()
Get the minimum allowed next bid. |
ModelObject |
getMinimumBidModel()
|
java.lang.String |
getName()
Get the start item name (which is the company name of the primary certificate). |
Certificate |
getPrimary()
Get the primary (or only) certificate. |
int |
getRow()
Get the row number. |
Certificate |
getSecondary()
Get the secondary certificate. |
int |
getStatus()
|
ModelObject |
getStatusModel()
|
java.lang.String |
getStatusName()
|
java.lang.String |
getText()
|
java.lang.String |
getType()
|
boolean |
hasBid(Player player)
Check if a player has done any bids on this start item. |
boolean |
hasSecondary()
Check if there is a secondary certificate. |
void |
init(GameManagerI gameManager)
Initialisation, to be called after all XML parsing has completed, and after IPO initialisation. |
boolean |
isSold()
Check if the start item has been sold. |
PublicCompanyI |
needsPriceSetting()
This method indicates if there is a company for which a par price must be set when this start item is bought. |
void |
reduceBasePriceBy(int amount)
|
void |
setBid(int amount,
Player bidder)
Register a bid. |
protected void |
setColumn(int column)
Set the start packet row. |
void |
setMinimumBid(int value)
|
protected void |
setRow(int row)
Set the start packet row. |
void |
setSecondary(java.lang.String name2,
java.lang.String type2,
boolean president2)
Add a secondary certificate, that "comes with" the primary certificate. |
void |
setSold(Player player,
int buyPrice)
Set the start item sold status. |
void |
setStatus(int status)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String name
protected Certificate primary
protected Certificate secondary
protected MoneyModel basePrice
protected int row
protected int column
protected int index
protected IntegerState lastBidderIndex
protected java.util.List<Player> players
protected int numberOfPlayers
protected MoneyModel[] bids
protected MoneyModel minimumBid
protected IntegerState status
public static final int UNAVAILABLE
public static final int BIDDABLE
public static final int BUYABLE
public static final int SELECTABLE
public static final int AUCTIONED
public static final int NEEDS_SHARE_PRICE
public static final int SOLD
public static final java.lang.String[] statusName
protected java.lang.String type
protected boolean president
protected java.lang.String name2
protected java.lang.String type2
protected boolean president2
protected static java.util.Map<java.lang.String,StartItem> startItemMap
protected static org.apache.log4j.Logger log
Constructor Detail |
---|
public StartItem(java.lang.String name, java.lang.String type, int basePrice, int index, boolean president)
name
- The Company name of the primary certificate. This name will
also become the name of the start item itself.type
- The CompanyType name of the primary certificate.basePrice
- The start item base selling price, i.e. the price for
which the item can be bought or where bidding starts.president
- True if the primary certificate is the president's
share.Method Detail |
---|
public void setSecondary(java.lang.String name2, java.lang.String type2, boolean president2)
name2
- The Company name of the secondary certificate.type2
- The CompanyType name of the secondary certificate.president2
- True if the secondary certificate is the president's
share.public void init(GameManagerI gameManager)
public int getIndex()
protected void setRow(int row)
Applies to games like 1835 where start items are organised and become available in rows.
row
- protected void setColumn(int column)
Applies to games like 1837 where start items are organised and become available in columns.
row
- public int getRow()
setRow()
public int getColumn()
setColumn()
public Certificate getPrimary()
public boolean hasSecondary()
public Certificate getSecondary()
public int getBasePrice()
public void reduceBasePriceBy(int amount)
public java.lang.String getName()
public void setBid(int amount, Player bidder)
This method does not check off the amount of money that a player has available for bidding.
amount
- The bid amount.bidder
- The bidding player.
special amounts are 0 for 18EU as buy price, -1 as standard pass, -2 and below as pass in 18EUpublic int getBid()
public int getBid(Player player)
player
- The name of the player.
public int getBidders()
public Player getBidder()
public int getMinimumBid()
public void setMinimumBid(int value)
public boolean hasBid(Player player)
playerName
- The name of the player.
public boolean isSold()
public void setSold(Player player, int buyPrice)
sold
- The new sold status (usually true).public PublicCompanyI needsPriceSetting()
protected PublicCompanyI checkNeedForPriceSetting(Certificate certificate)
certificate
-
public int getStatus()
public ModelObject getStatusModel()
public java.lang.String getStatusName()
public void setStatus(int status)
public ModelObject getBasePriceModel()
public ModelObject getBidForPlayerModel(int index)
public ModelObject getMinimumBidModel()
public static StartItem getByName(java.lang.String name)
public java.lang.String getType()
public boolean equals(StartItem item)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getText()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |