Class AbstractCheckerboardViewer<P extends Player<P,S>,S,IMG,SF extends SpriteFactory<IMG,S,?>,CBV extends CheckerboardViewer<P,S,CBV>>

java.lang.Object
org.refcodes.checkerboard.AbstractCheckerboardViewer<P,S,IMG,SF,CBV>
Type Parameters:
P - the generic type
S - The type which's instances represent a Player state.
IMG - The type for the state's representation ("image").
SF - the generic type
CBV - The CheckerboardViewer's type implementing this interface.
All Implemented Interfaces:
CheckerboardObserver<P,S>, CheckerboardViewer<P,S,CBV>, org.refcodes.component.Component, org.refcodes.component.Destroyable, org.refcodes.component.Initializable, org.refcodes.component.Initializable.InitializeBuilder<CBV>, org.refcodes.component.InitializableComponent, org.refcodes.graphical.GridDimension, org.refcodes.graphical.GridHeightAccessor, org.refcodes.graphical.GridModeAccessor, org.refcodes.graphical.GridWidthAccessor, org.refcodes.graphical.MinViewportDimension, org.refcodes.graphical.MinViewportDimension.MinViewportDimensionBuilder<CBV>, org.refcodes.graphical.MinViewportDimension.MinViewportDimensionMutator, org.refcodes.graphical.MinViewportDimension.MinViewportDimensionProperty, org.refcodes.graphical.Viewport, org.refcodes.graphical.ViewportDimension, org.refcodes.graphical.ViewportDimension.ViewportDimensionAccessor, org.refcodes.graphical.ViewportDimension.ViewportDimensionBuilder<CBV>, org.refcodes.graphical.ViewportDimension.ViewportDimensionMutator, org.refcodes.graphical.ViewportDimension.ViewportDimensionProperty, org.refcodes.graphical.ViewportHeightAccessor, org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightBuilder<CBV>, org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightMutator, org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightProperty, org.refcodes.graphical.ViewportOffset, org.refcodes.graphical.ViewportOffset.ViewportOffsetAccessor, org.refcodes.graphical.ViewportOffset.ViewportOffsetBuilder<CBV>, org.refcodes.graphical.ViewportOffset.ViewportOffsetMutator, org.refcodes.graphical.ViewportOffset.ViewportOffsetProperty, org.refcodes.graphical.ViewportOffsetXAccessor, org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXBuilder<CBV>, org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXMutator, org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXProperty, org.refcodes.graphical.ViewportOffsetYAccessor, org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYBuilder<CBV>, org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYMutator, org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYProperty, org.refcodes.graphical.ViewportWidthAccessor, org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthBuilder<CBV>, org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthMutator, org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthProperty, org.refcodes.observer.ObservableObserver<Checkerboard<P,S>>
Direct Known Subclasses:
AbstractGraphicalCheckerboardViewer, ConsoleCheckerboardViewer

public abstract class AbstractCheckerboardViewer<P extends Player<P,S>,S,IMG,SF extends SpriteFactory<IMG,S,?>,CBV extends CheckerboardViewer<P,S,CBV>> extends Object implements CheckerboardViewer<P,S,CBV>
In order to provide a Checkerboard, register an observer by invoking Observable.subscribeObserver(Object). The default Observable.subscribeObserver(Object) method will invoke this onSubscribe(SubscribeEvent) method which in turn sets the Checkerboard instance. Retrieve it by calling _checkerboard
  • 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.GridDimensionAccessor, org.refcodes.graphical.GridDimension.GridDimensionBuilder<B extends org.refcodes.graphical.GridDimension.GridDimensionBuilder<B>>, org.refcodes.graphical.GridDimension.GridDimensionMutator, org.refcodes.graphical.GridDimension.GridDimensionProperty

    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

    Nested classes/interfaces inherited from interface org.refcodes.component.Initializable

    org.refcodes.component.Initializable.InitializeAutomaton, org.refcodes.component.Initializable.InitializeBuilder<B extends org.refcodes.component.Initializable.InitializeBuilder<B>>, org.refcodes.component.Initializable.UncheckedInitializable

    Nested classes/interfaces inherited from interface org.refcodes.graphical.MinViewportDimension

    org.refcodes.graphical.MinViewportDimension.MinViewportDimensionBuilder<B extends org.refcodes.graphical.MinViewportDimension.MinViewportDimensionBuilder<B>>, org.refcodes.graphical.MinViewportDimension.MinViewportDimensionMutator, org.refcodes.graphical.MinViewportDimension.MinViewportDimensionProperty

    Nested classes/interfaces inherited from interface org.refcodes.graphical.ViewportDimension

    org.refcodes.graphical.ViewportDimension.ViewportDimensionAccessor, org.refcodes.graphical.ViewportDimension.ViewportDimensionBuilder<B extends org.refcodes.graphical.ViewportDimension.ViewportDimensionBuilder<B>>, org.refcodes.graphical.ViewportDimension.ViewportDimensionMutator, org.refcodes.graphical.ViewportDimension.ViewportDimensionProperty

    Nested classes/interfaces inherited from interface org.refcodes.graphical.ViewportHeightAccessor

    org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightBuilder<B extends org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightBuilder<B>>, org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightMutator, org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightProperty

    Nested classes/interfaces inherited from interface org.refcodes.graphical.ViewportOffset

    org.refcodes.graphical.ViewportOffset.ViewportOffsetAccessor, org.refcodes.graphical.ViewportOffset.ViewportOffsetBuilder<B extends org.refcodes.graphical.ViewportOffset.ViewportOffsetBuilder<B>>, org.refcodes.graphical.ViewportOffset.ViewportOffsetMutator, org.refcodes.graphical.ViewportOffset.ViewportOffsetProperty

    Nested classes/interfaces inherited from interface org.refcodes.graphical.ViewportOffsetXAccessor

    org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXBuilder<B extends org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXBuilder<B>>, org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXMutator, org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXProperty

    Nested classes/interfaces inherited from interface org.refcodes.graphical.ViewportOffsetYAccessor

    org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYBuilder<B extends org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYBuilder<B>>, org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYMutator, org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYProperty

    Nested classes/interfaces inherited from interface org.refcodes.graphical.ViewportWidthAccessor

    org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthBuilder<B extends org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthBuilder<B>>, org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthMutator, org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthProperty
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Checkerboard<P,S>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs the CheckerboardViewer for the given Checkerboard.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    centerViewortOffset(int aPositionX, int aPositionY)
    void
    centerViewortOffset(int aPositionX, int aPositionY, int aViewportWidth, int aViewportHeight)
    void
    int
    org.refcodes.graphical.GridMode
    int
    org.refcodes.graphical.ViewportDimension
    int
    int
    int
    int
    void
    onSubscribe(org.refcodes.observer.SubscribeEvent<Checkerboard<P,S>> aSubscribeEvent)
    void
    onUnsubscribe(org.refcodes.observer.UnsubscribeEvent<Checkerboard<P,S>> aUnsubscribeEvent)
    void
    setMinViewportDimension(int aWidth, int aHeight)
    void
    setMinViewportDimension(org.refcodes.graphical.Dimension aDimension)
    void
    setMinViewportDimension(org.refcodes.graphical.ViewportDimension aDimension)
    void
    setViewportDimension(int aWidth, int aHeight)
    void
    setViewportDimension(org.refcodes.graphical.Dimension aDimension)
    void
    setViewportDimension(org.refcodes.graphical.ViewportDimension aGridDimension)
    void
    setViewportHeight(int aGridHeight)
    void
    setViewportOffset(int aPosX, int aPosY)
    void
    setViewportOffset(org.refcodes.graphical.Offset aOffset)
    void
    setViewportOffset(org.refcodes.graphical.Position aOffset)
    void
    setViewportOffset(org.refcodes.graphical.ViewportOffset aOffset)
    void
    setViewportOffsetX(int aPosX)
    void
    setViewportOffsetY(int aPosY)
    void
    setViewportWidth(int aGridWidth)
    With initialize.
    withMinViewportDimension(int aWidth, int aHeight)
    With min viewport dimension.
    withMinViewportDimension(org.refcodes.graphical.Dimension aDimension)
    withMinViewportDimension(org.refcodes.graphical.ViewportDimension aDimension)
    With min viewport dimension.
    withViewportDimension(int aWidth, int aHeight)
    With viewport dimension.
    withViewportDimension(org.refcodes.graphical.Dimension aDimension)
    With viewport dimension.
    withViewportDimension(org.refcodes.graphical.ViewportDimension aGridDimension)
    With viewport dimension.
    withViewportHeight(int aGridHeight)
    With viewport height.
    withViewportOffset(int aPosX, int aPosY)
    With viewport offset.
    withViewportOffset(org.refcodes.graphical.Offset aOffset)
    With viewport offset.
    withViewportOffset(org.refcodes.graphical.Position aOffset)
    With viewport offset.
    withViewportOffset(org.refcodes.graphical.ViewportOffset aOffset)
    With viewport offset.
    With viewport offset X.
    With viewport offset Y.
    withViewportWidth(int aGridWidth)
    With viewport width.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.refcodes.graphical.GridDimension

    isInBounds, isInBounds, isInHeight, isInWidth

    Methods inherited from interface org.refcodes.component.Initializable

    initialize, initializeUnchecked

    Methods inherited from interface org.refcodes.component.Initializable.InitializeBuilder

    withInitializeUnchecked

    Methods inherited from interface org.refcodes.graphical.MinViewportDimension.MinViewportDimensionProperty

    letMinViewportDimension, letMinViewportDimension, letMinViewportDimension

    Methods inherited from interface org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightProperty

    letViewportHeight

    Methods inherited from interface org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXProperty

    letViewportOffsetX

    Methods inherited from interface org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYProperty

    letViewportOffsetY

    Methods inherited from interface org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthProperty

    letViewportWidth
  • Field Details

  • Constructor Details

  • Method Details

    • withInitialize

      public CBV withInitialize() throws org.refcodes.component.InitializeException
      With initialize.
      Specified by:
      withInitialize in interface org.refcodes.component.Initializable.InitializeBuilder<P extends Player<P,S>>
      Returns:
      the cbv
      Throws:
      org.refcodes.component.InitializeException - the initialize exception
    • withViewportOffsetY

      public CBV withViewportOffsetY(int aPosY)
      With viewport offset Y.
      Specified by:
      withViewportOffsetY in interface org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYBuilder<P extends Player<P,S>>
      Parameters:
      aPosY - the pos Y
      Returns:
      the cbv
    • withViewportHeight

      public CBV withViewportHeight(int aGridHeight)
      With viewport height.
      Specified by:
      withViewportHeight in interface org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightBuilder<P extends Player<P,S>>
      Parameters:
      aGridHeight - the grid height
      Returns:
      the cbv
    • withViewportWidth

      public CBV withViewportWidth(int aGridWidth)
      With viewport width.
      Specified by:
      withViewportWidth in interface org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthBuilder<P extends Player<P,S>>
      Parameters:
      aGridWidth - the grid width
      Returns:
      the cbv
    • withViewportDimension

      public CBV withViewportDimension(int aWidth, int aHeight)
      With viewport dimension.
      Specified by:
      withViewportDimension in interface org.refcodes.graphical.ViewportDimension.ViewportDimensionBuilder<P extends Player<P,S>>
      Parameters:
      aWidth - the width
      aHeight - the height
      Returns:
      the cbv
    • withViewportDimension

      public CBV withViewportDimension(org.refcodes.graphical.ViewportDimension aGridDimension)
      With viewport dimension.
      Specified by:
      withViewportDimension in interface org.refcodes.graphical.ViewportDimension.ViewportDimensionBuilder<P extends Player<P,S>>
      Parameters:
      aGridDimension - the grid dimension
      Returns:
      the cbv
    • withViewportDimension

      public CBV withViewportDimension(org.refcodes.graphical.Dimension aDimension)
      With viewport dimension.
      Specified by:
      withViewportDimension in interface org.refcodes.graphical.ViewportDimension.ViewportDimensionBuilder<P extends Player<P,S>>
      Parameters:
      aDimension - the dimension
      Returns:
      the cbv
    • withViewportOffset

      public CBV withViewportOffset(int aPosX, int aPosY)
      With viewport offset.
      Specified by:
      withViewportOffset in interface org.refcodes.graphical.ViewportOffset.ViewportOffsetBuilder<P extends Player<P,S>>
      Parameters:
      aPosX - the pos X
      aPosY - the pos Y
      Returns:
      the cbv
    • withViewportOffset

      public CBV withViewportOffset(org.refcodes.graphical.Position aOffset)
      With viewport offset.
      Specified by:
      withViewportOffset in interface org.refcodes.graphical.ViewportOffset.ViewportOffsetBuilder<P extends Player<P,S>>
      Parameters:
      aOffset - the offset
      Returns:
      the cbv
    • withViewportOffset

      public CBV withViewportOffset(org.refcodes.graphical.ViewportOffset aOffset)
      With viewport offset.
      Specified by:
      withViewportOffset in interface org.refcodes.graphical.ViewportOffset.ViewportOffsetBuilder<P extends Player<P,S>>
      Parameters:
      aOffset - the offset
      Returns:
      the cbv
    • withViewportOffset

      public CBV withViewportOffset(org.refcodes.graphical.Offset aOffset)
      With viewport offset.
      Specified by:
      withViewportOffset in interface org.refcodes.graphical.ViewportOffset.ViewportOffsetBuilder<P extends Player<P,S>>
      Parameters:
      aOffset - the offset
      Returns:
      the cbv
    • withViewportOffsetX

      public CBV withViewportOffsetX(int aPosX)
      With viewport offset X.
      Specified by:
      withViewportOffsetX in interface org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXBuilder<P extends Player<P,S>>
      Parameters:
      aPosX - the pos X
      Returns:
      the cbv
    • withMinViewportDimension

      public CBV withMinViewportDimension(org.refcodes.graphical.ViewportDimension aDimension)
      With min viewport dimension.
      Specified by:
      withMinViewportDimension in interface org.refcodes.graphical.MinViewportDimension.MinViewportDimensionBuilder<P extends Player<P,S>>
      Parameters:
      aDimension - the dimension
      Returns:
      the cbv
    • withMinViewportDimension

      public CBV withMinViewportDimension(int aWidth, int aHeight)
      With min viewport dimension.
      Specified by:
      withMinViewportDimension in interface org.refcodes.graphical.MinViewportDimension.MinViewportDimensionBuilder<P extends Player<P,S>>
      Parameters:
      aWidth - the width
      aHeight - the height
      Returns:
      the cbv
    • setViewportDimension

      public void setViewportDimension(int aWidth, int aHeight)
      Specified by:
      setViewportDimension in interface org.refcodes.graphical.ViewportDimension.ViewportDimensionMutator
    • setViewportDimension

      public void setViewportDimension(org.refcodes.graphical.ViewportDimension aGridDimension)
      Specified by:
      setViewportDimension in interface org.refcodes.graphical.ViewportDimension.ViewportDimensionMutator
    • setViewportDimension

      public void setViewportDimension(org.refcodes.graphical.Dimension aDimension)
      Specified by:
      setViewportDimension in interface org.refcodes.graphical.ViewportDimension.ViewportDimensionMutator
    • setViewportWidth

      public void setViewportWidth(int aGridWidth)
      Specified by:
      setViewportWidth in interface org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthMutator
    • setViewportHeight

      public void setViewportHeight(int aGridHeight)
      Specified by:
      setViewportHeight in interface org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightMutator
    • getViewportWidth

      public int getViewportWidth()
      Specified by:
      getViewportWidth in interface org.refcodes.graphical.ViewportWidthAccessor
    • getViewportHeight

      public int getViewportHeight()
      Specified by:
      getViewportHeight in interface org.refcodes.graphical.ViewportHeightAccessor
    • setViewportOffset

      public void setViewportOffset(int aPosX, int aPosY)
      Specified by:
      setViewportOffset in interface org.refcodes.graphical.ViewportOffset.ViewportOffsetMutator
    • setViewportOffset

      public void setViewportOffset(org.refcodes.graphical.Position aOffset)
      Specified by:
      setViewportOffset in interface org.refcodes.graphical.ViewportOffset.ViewportOffsetMutator
    • setViewportOffset

      public void setViewportOffset(org.refcodes.graphical.ViewportOffset aOffset)
      Specified by:
      setViewportOffset in interface org.refcodes.graphical.ViewportOffset.ViewportOffsetMutator
    • setViewportOffset

      public void setViewportOffset(org.refcodes.graphical.Offset aOffset)
      Specified by:
      setViewportOffset in interface org.refcodes.graphical.ViewportOffset.ViewportOffsetMutator
    • setViewportOffsetX

      public void setViewportOffsetX(int aPosX)
      Specified by:
      setViewportOffsetX in interface org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXMutator
    • getViewportOffsetX

      public int getViewportOffsetX()
      Specified by:
      getViewportOffsetX in interface org.refcodes.graphical.ViewportOffsetXAccessor
    • getViewportOffsetY

      public int getViewportOffsetY()
      Specified by:
      getViewportOffsetY in interface org.refcodes.graphical.ViewportOffsetYAccessor
    • setViewportOffsetY

      public void setViewportOffsetY(int aPosY)
      Specified by:
      setViewportOffsetY in interface org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYMutator
    • setMinViewportDimension

      public void setMinViewportDimension(org.refcodes.graphical.ViewportDimension aDimension)
      Specified by:
      setMinViewportDimension in interface org.refcodes.graphical.MinViewportDimension.MinViewportDimensionMutator
    • getMinViewportDimension

      public org.refcodes.graphical.ViewportDimension getMinViewportDimension()
      Specified by:
      getMinViewportDimension in interface org.refcodes.graphical.MinViewportDimension
    • setMinViewportDimension

      public void setMinViewportDimension(int aWidth, int aHeight)
      Specified by:
      setMinViewportDimension in interface org.refcodes.graphical.MinViewportDimension.MinViewportDimensionMutator
    • setMinViewportDimension

      public void setMinViewportDimension(org.refcodes.graphical.Dimension aDimension)
      Specified by:
      setMinViewportDimension in interface org.refcodes.graphical.MinViewportDimension.MinViewportDimensionMutator
    • withMinViewportDimension

      public CBV withMinViewportDimension(org.refcodes.graphical.Dimension aDimension)
      Specified by:
      withMinViewportDimension in interface org.refcodes.graphical.MinViewportDimension.MinViewportDimensionBuilder<P extends Player<P,S>>
    • centerViewortOffset

      public void centerViewortOffset(int aPositionX, int aPositionY)
      Specified by:
      centerViewortOffset in interface CheckerboardViewer<P extends Player<P,S>,S,IMG>
      Specified by:
      centerViewortOffset in interface org.refcodes.graphical.Viewport
    • centerViewortOffset

      public void centerViewortOffset(int aPositionX, int aPositionY, int aViewportWidth, int aViewportHeight)
      Specified by:
      centerViewortOffset in interface CheckerboardViewer<P extends Player<P,S>,S,IMG>
      Specified by:
      centerViewortOffset in interface org.refcodes.graphical.Viewport
    • 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
    • destroy

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

      public void onSubscribe(org.refcodes.observer.SubscribeEvent<Checkerboard<P,S>> aSubscribeEvent)
      Specified by:
      onSubscribe in interface org.refcodes.observer.ObservableObserver<P extends Player<P,S>>
    • onUnsubscribe

      public void onUnsubscribe(org.refcodes.observer.UnsubscribeEvent<Checkerboard<P,S>> aUnsubscribeEvent)
      Specified by:
      onUnsubscribe in interface org.refcodes.observer.ObservableObserver<P extends Player<P,S>>