Class BoulderDashBoardImpl

  • All Implemented Interfaces:
    BoulderDashBoard, org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>, org.refcodes.checkerboard.Players<BoulderDashPlayer>, org.refcodes.component.Component, org.refcodes.component.Destroyable, org.refcodes.graphical.GridDimension, org.refcodes.graphical.GridDimension.GridDimensionBuilder<BoulderDashPlayer>, org.refcodes.graphical.GridDimension.GridDimensionMutator, org.refcodes.graphical.GridDimension.GridDimensionProperty, org.refcodes.graphical.GridHeightAccessor, org.refcodes.graphical.GridHeightAccessor.GridHeightBuilder<BoulderDashPlayer>, org.refcodes.graphical.GridHeightAccessor.GridHeightMutator, org.refcodes.graphical.GridHeightAccessor.GridHeightProperty, org.refcodes.graphical.GridModeAccessor, org.refcodes.graphical.GridModeAccessor.GridModeBuilder<BoulderDashPlayer>, org.refcodes.graphical.GridModeAccessor.GridModeMutator, org.refcodes.graphical.GridModeAccessor.GridModeProperty, org.refcodes.graphical.GridWidthAccessor, org.refcodes.graphical.GridWidthAccessor.GridWidthBuilder<BoulderDashPlayer>, org.refcodes.graphical.GridWidthAccessor.GridWidthMutator, org.refcodes.graphical.GridWidthAccessor.GridWidthProperty, org.refcodes.observer.Observable<BoulderDashPlayer>
    Direct Known Subclasses:
    BoulderDashAutomaton


    public class BoulderDashBoardImpl
    extends java.lang.Object
    implements BoulderDashBoard
    Wrapper for a Checkerboard for the BoulderDashPlayer instances with the BoulderDashStatus.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.refcodes.component.Destroyable

        org.refcodes.component.Destroyable.DestroyAutomaton
      • Nested classes/interfaces inherited from interface org.refcodes.graphical.GridDimension

        org.refcodes.graphical.GridDimension.GridDimensionBuilder<B extends org.refcodes.graphical.GridDimension.GridDimensionBuilder<B>>, org.refcodes.graphical.GridDimension.GridDimensionMutator, org.refcodes.graphical.GridDimension.GridDimensionProperty, org.refcodes.graphical.GridDimension.GridDimensionPropertyBuilder
      • Nested classes/interfaces inherited from interface org.refcodes.graphical.GridHeightAccessor

        org.refcodes.graphical.GridHeightAccessor.GridHeightBuilder<B extends org.refcodes.graphical.GridHeightAccessor.GridHeightBuilder<B>>, org.refcodes.graphical.GridHeightAccessor.GridHeightMutator, org.refcodes.graphical.GridHeightAccessor.GridHeightProperty
      • Nested classes/interfaces inherited from interface org.refcodes.graphical.GridModeAccessor

        org.refcodes.graphical.GridModeAccessor.GridModeBuilder<B extends org.refcodes.graphical.GridModeAccessor.GridModeBuilder<B>>, org.refcodes.graphical.GridModeAccessor.GridModeMutator, org.refcodes.graphical.GridModeAccessor.GridModeProperty
      • Nested classes/interfaces inherited from interface org.refcodes.graphical.GridWidthAccessor

        org.refcodes.graphical.GridWidthAccessor.GridWidthBuilder<B extends org.refcodes.graphical.GridWidthAccessor.GridWidthBuilder<B>>, org.refcodes.graphical.GridWidthAccessor.GridWidthMutator, org.refcodes.graphical.GridWidthAccessor.GridWidthProperty
    • Constructor Summary

      Constructors 
      Constructor Description
      BoulderDashBoardImpl​(org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus> aCheckerboard)
      Constructs a BoulderDashBoard from the provided Checkerboard.
    • Constructor Detail

      • BoulderDashBoardImpl

        public BoulderDashBoardImpl​(org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus> aCheckerboard)
        Constructs a BoulderDashBoard from the provided Checkerboard.
        Parameters:
        aCheckerboard - The Checkerboard which to by the BoulderDashBoard.
    • Method Detail

      • forEach

        public void forEach​(java.util.function.Consumer<BoulderDashPlayer> aConsumer)
        Specified by:
        forEach in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
      • hasAtPosition

        public boolean hasAtPosition​(org.refcodes.graphical.Position aPos)
                              throws java.lang.IndexOutOfBoundsException
        Specified by:
        hasAtPosition in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • hasAtPosition

        public boolean hasAtPosition​(int aPosX,
                                     int aPosY)
                              throws java.lang.IndexOutOfBoundsException
        Specified by:
        hasAtPosition in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • atPosition

        public BoulderDashPlayer atPosition​(org.refcodes.graphical.Position aPos)
                                     throws java.lang.IndexOutOfBoundsException
        Specified by:
        atPosition in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • getGridMode

        public org.refcodes.graphical.GridMode getGridMode​()
        Specified by:
        getGridMode in interface org.refcodes.graphical.GridModeAccessor
      • getGridWidth

        public int getGridWidth​()
        Specified by:
        getGridWidth in interface org.refcodes.graphical.GridWidthAccessor
      • getGridHeight

        public int getGridHeight​()
        Specified by:
        getGridHeight in interface org.refcodes.graphical.GridHeightAccessor
      • atPosition

        public BoulderDashPlayer atPosition​(int aPosX,
                                            int aPosY)
                                     throws java.lang.IndexOutOfBoundsException
        Specified by:
        atPosition in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • getRow

        public java.util.Map<java.lang.Integer,BoulderDashPlayer> getRow​(int aRow)
                                                                  throws java.lang.IndexOutOfBoundsException
        Specified by:
        getRow in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • getColumn

        public java.util.Map<java.lang.Integer,BoulderDashPlayer> getColumn​(int aColumn)
                                                                     throws java.lang.IndexOutOfBoundsException
        Specified by:
        getColumn in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • clearPlayers

        public void clearPlayers​()
        Specified by:
        clearPlayers in interface org.refcodes.checkerboard.Players<BoulderDashPlayer>
      • atTopOf

        public BoulderDashPlayer atTopOf​(org.refcodes.graphical.Position aPos)
                                  throws java.lang.IndexOutOfBoundsException
        Specified by:
        atTopOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • atTopRightOf

        public BoulderDashPlayer atTopRightOf​(org.refcodes.graphical.Position aPos)
                                       throws java.lang.IndexOutOfBoundsException
        Specified by:
        atTopRightOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • hasAtRightOf

        public boolean hasAtRightOf​(org.refcodes.graphical.Position aPos)
                             throws java.lang.IndexOutOfBoundsException
        Specified by:
        hasAtRightOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • atRightOf

        public BoulderDashPlayer atRightOf​(org.refcodes.graphical.Position aPos)
                                    throws java.lang.IndexOutOfBoundsException
        Specified by:
        atRightOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • hasAtBottomRightOf

        public boolean hasAtBottomRightOf​(org.refcodes.graphical.Position aPos)
                                   throws java.lang.IndexOutOfBoundsException
        Specified by:
        hasAtBottomRightOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • atBottomRightOf

        public BoulderDashPlayer atBottomRightOf​(org.refcodes.graphical.Position aPos)
                                          throws java.lang.IndexOutOfBoundsException
        Specified by:
        atBottomRightOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • hasAtBottomOf

        public boolean hasAtBottomOf​(org.refcodes.graphical.Position aPos)
                              throws java.lang.IndexOutOfBoundsException
        Specified by:
        hasAtBottomOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • atBottomOf

        public BoulderDashPlayer atBottomOf​(org.refcodes.graphical.Position aPos)
                                     throws java.lang.IndexOutOfBoundsException
        Specified by:
        atBottomOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • hasAtBottomLeftOf

        public boolean hasAtBottomLeftOf​(org.refcodes.graphical.Position aPos)
                                  throws java.lang.IndexOutOfBoundsException
        Specified by:
        hasAtBottomLeftOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • atBottomLeftOf

        public BoulderDashPlayer atBottomLeftOf​(org.refcodes.graphical.Position aPos)
                                         throws java.lang.IndexOutOfBoundsException
        Specified by:
        atBottomLeftOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • hasAtLeftOf

        public boolean hasAtLeftOf​(org.refcodes.graphical.Position aPos)
                            throws java.lang.IndexOutOfBoundsException
        Specified by:
        hasAtLeftOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • atLeftOf

        public BoulderDashPlayer atLeftOf​(org.refcodes.graphical.Position aPos)
                                   throws java.lang.IndexOutOfBoundsException
        Specified by:
        atLeftOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • atTopLeftOf

        public BoulderDashPlayer atTopLeftOf​(org.refcodes.graphical.Position aPos)
                                      throws java.lang.IndexOutOfBoundsException
        Specified by:
        atTopLeftOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • destroy

        public void destroy​()
        Specified by:
        destroy in interface org.refcodes.component.Destroyable
      • setGridDimension

        public void setGridDimension​(int aWidth,
                                     int aHeight)
        Specified by:
        setGridDimension in interface org.refcodes.graphical.GridDimension.GridDimensionMutator
      • setGridMode

        public void setGridMode​(org.refcodes.graphical.GridMode aGridMode)
        Specified by:
        setGridMode in interface org.refcodes.graphical.GridModeAccessor.GridModeMutator
      • setGridWidth

        public void setGridWidth​(int aWidth)
        Specified by:
        setGridWidth in interface org.refcodes.graphical.GridWidthAccessor.GridWidthMutator
      • setGridHeight

        public void setGridHeight​(int aHeight)
        Specified by:
        setGridHeight in interface org.refcodes.graphical.GridHeightAccessor.GridHeightMutator
      • setGridDimension

        public void setGridDimension​(org.refcodes.graphical.GridDimension aDimension)
        Specified by:
        setGridDimension in interface org.refcodes.graphical.GridDimension.GridDimensionMutator
      • setGridDimension

        public void setGridDimension​(org.refcodes.graphical.Dimension aDimension)
        Specified by:
        setGridDimension in interface org.refcodes.graphical.GridDimension.GridDimensionMutator
      • playerCount

        public int playerCount​()
        Specified by:
        playerCount in interface org.refcodes.checkerboard.Players<BoulderDashPlayer>
      • hasPlayers

        public boolean hasPlayers​()
        Specified by:
        hasPlayers in interface org.refcodes.checkerboard.Players<BoulderDashPlayer>
      • withGridWidth

        public org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus> withGridWidth​(int aWidth)
        Specified by:
        withGridWidth in interface org.refcodes.graphical.GridWidthAccessor.GridWidthBuilder<BoulderDashPlayer>
      • withGridMode

        public org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus> withGridMode​(org.refcodes.graphical.GridMode aGridMode)
        Specified by:
        withGridMode in interface org.refcodes.graphical.GridModeAccessor.GridModeBuilder<BoulderDashPlayer>
      • withGridHeight

        public org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus> withGridHeight​(int aHeight)
        Specified by:
        withGridHeight in interface org.refcodes.graphical.GridHeightAccessor.GridHeightBuilder<BoulderDashPlayer>
      • withGridDimension

        public org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus> withGridDimension​(int aGridWidth,
                                                                                                                                               int aGridHeight)
        Specified by:
        withGridDimension in interface org.refcodes.graphical.GridDimension.GridDimensionBuilder<BoulderDashPlayer>
      • hasAtTopOf

        public boolean hasAtTopOf​(org.refcodes.graphical.Position aPos)
                           throws java.lang.IndexOutOfBoundsException
        Specified by:
        hasAtTopOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • removePlayer

        public boolean removePlayer​(BoulderDashPlayer aElement)
        Specified by:
        removePlayer in interface org.refcodes.checkerboard.Players<BoulderDashPlayer>
      • withGridDimension

        public org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus> withGridDimension​(org.refcodes.graphical.GridDimension aDimension)
        Specified by:
        withGridDimension in interface org.refcodes.graphical.GridDimension.GridDimensionBuilder<BoulderDashPlayer>
      • withGridDimension

        public org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus> withGridDimension​(org.refcodes.graphical.Dimension aDimension)
        Specified by:
        withGridDimension in interface org.refcodes.graphical.GridDimension.GridDimensionBuilder<BoulderDashPlayer>
      • hasAtTopRightOf

        public boolean hasAtTopRightOf​(org.refcodes.graphical.Position aPos)
                                throws java.lang.IndexOutOfBoundsException
        Specified by:
        hasAtTopRightOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • hasAtTopLeftOf

        public boolean hasAtTopLeftOf​(org.refcodes.graphical.Position aPos)
                               throws java.lang.IndexOutOfBoundsException
        Specified by:
        hasAtTopLeftOf in interface org.refcodes.checkerboard.Checkerboard<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus>
        Throws:
        java.lang.IndexOutOfBoundsException
      • hasObserverSubscription

        public boolean hasObserverSubscription​(org.refcodes.checkerboard.CheckerboardObserver<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus> arg0)
        Specified by:
        hasObserverSubscription in interface org.refcodes.observer.Observable<BoulderDashPlayer>
      • subscribeObserver

        public boolean subscribeObserver​(org.refcodes.checkerboard.CheckerboardObserver<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus> arg0)
        Specified by:
        subscribeObserver in interface org.refcodes.observer.Observable<BoulderDashPlayer>
      • unsubscribeObserver

        public boolean unsubscribeObserver​(org.refcodes.checkerboard.CheckerboardObserver<BoulderDashPlayer,org.refcodes.data.ext.boulderdash.BoulderDashStatus> arg0)
        Specified by:
        unsubscribeObserver in interface org.refcodes.observer.Observable<BoulderDashPlayer>