Package it.polimi.ingsw.model.market
Class Market
java.lang.Object
it.polimi.ingsw.model.market.Market
- All Implemented Interfaces:
MarketSetupObservable,MarketUpdateObservable
public class Market extends java.lang.Object implements MarketUpdateObservable, MarketSetupObservable
Represents the market of the game where players can buy a row or column of marble that will be converted in resources
-
Constructor Summary
Constructors Constructor Description Market(ModelObserver controller) -
Method Summary
Modifier and Type Method Description intgetNumberOfColumn()intgetNumberOfRow()MarketMarble[][]getStatus()Get the current arrangement of marbles in this marketvoidnotifyMarketSetup(MarketSetup msg)Notify the model observers that initial market setup has occurred Along with the notification sends the proper update Object as further explained in project documentationvoidnotifyMarketUpdate(MarketUpdate msg)Notify the model observers that a market row or column has been pushed Along with the notification sends the proper update Object as further explained in project documentationjava.util.List<MarketMarble>pushInColumn(int column)Push the marble in slide in the specified row from rightjava.util.List<MarketMarble>pushInRow(int row)Push the marble in slide in the specified row from rightvoidsetController(NetworkVirtualView networkVirtualView)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Market
-
-
Method Details
-
getNumberOfRow
public int getNumberOfRow() -
getNumberOfColumn
public int getNumberOfColumn() -
pushInRow
Push the marble in slide in the specified row from right- Parameters:
row- the row in which to push the marble- Returns:
- the row before pushing the marble
- Throws:
RowOrColumnNotExistsException- this row doesn't exist
-
pushInColumn
Push the marble in slide in the specified row from right- Parameters:
column- the row in which to push the marble- Returns:
- the row before pushing the marble
- Throws:
RowOrColumnNotExistsException- this column doesn't exist
-
getStatus
Get the current arrangement of marbles in this market- Returns:
- the marbles' arrangement
-
notifyMarketUpdate
Description copied from interface:MarketUpdateObservableNotify the model observers that a market row or column has been pushed Along with the notification sends the proper update Object as further explained in project documentation- Specified by:
notifyMarketUpdatein interfaceMarketUpdateObservable- Parameters:
msg- the update object representing a market update
-
notifyMarketSetup
Description copied from interface:MarketSetupObservableNotify the model observers that initial market setup has occurred Along with the notification sends the proper update Object as further explained in project documentation- Specified by:
notifyMarketSetupin interfaceMarketSetupObservable- Parameters:
msg- the update object representing a market setup containing the whole market
-
setController
-