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
    int getNumberOfColumn()  
    int getNumberOfRow()  
    MarketMarble[][] getStatus()
    Get the current arrangement of marbles in this market
    void notifyMarketSetup​(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 documentation
    void notifyMarketUpdate​(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 documentation
    java.util.List<MarketMarble> pushInColumn​(int column)
    Push the marble in slide in the specified row from right
    java.util.List<MarketMarble> pushInRow​(int row)
    Push the marble in slide in the specified row from right
    void setController​(NetworkVirtualView networkVirtualView)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getNumberOfRow

      public int getNumberOfRow()
    • getNumberOfColumn

      public int getNumberOfColumn()
    • pushInRow

      public java.util.List<MarketMarble> pushInRow​(int row) throws RowOrColumnNotExistsException
      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

      public java.util.List<MarketMarble> pushInColumn​(int column) throws RowOrColumnNotExistsException
      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

      public MarketMarble[][] getStatus()
      Get the current arrangement of marbles in this market
      Returns:
      the marbles' arrangement
    • notifyMarketUpdate

      public void notifyMarketUpdate​(MarketUpdate msg)
      Description copied from interface: MarketUpdateObservable
      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 documentation
      Specified by:
      notifyMarketUpdate in interface MarketUpdateObservable
      Parameters:
      msg - the update object representing a market update
    • notifyMarketSetup

      public void notifyMarketSetup​(MarketSetup msg)
      Description copied from interface: MarketSetupObservable
      Notify 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:
      notifyMarketSetup in interface MarketSetupObservable
      Parameters:
      msg - the update object representing a market setup containing the whole market
    • setController

      public void setController​(NetworkVirtualView networkVirtualView)