P
- the generic type of the Player
S
- The type which's instances represent a Player
state.CheckerboardObserver<P,S>
, CheckerboardViewer<P,S,ConsoleCheckerboardViewer<P,S>>
, ConsoleCheckerboardViewer<P,S>
, org.refcodes.component.Component
, org.refcodes.component.Destroyable
, org.refcodes.component.Initializable
, org.refcodes.component.Initializable.InitializeBuilder<P>
, 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<P>
, org.refcodes.graphical.MinViewportDimension.MinViewportDimensionMutator
, org.refcodes.graphical.MinViewportDimension.MinViewportDimensionProperty
, org.refcodes.graphical.ViewportDimension
, org.refcodes.graphical.ViewportDimension.ViewportDimensionBuilder<P>
, org.refcodes.graphical.ViewportDimension.ViewportDimensionMutator
, org.refcodes.graphical.ViewportDimension.ViewportDimensionProperty
, org.refcodes.graphical.ViewportHeightAccessor
, org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightBuilder<P>
, org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightMutator
, org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightProperty
, org.refcodes.graphical.ViewportOffset
, org.refcodes.graphical.ViewportOffset.ViewportOffsetBuilder<P>
, org.refcodes.graphical.ViewportOffset.ViewportOffsetMutator
, org.refcodes.graphical.ViewportOffset.ViewportOffsetProperty
, org.refcodes.graphical.ViewportOffsetXAccessor
, org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXBuilder<P>
, org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXMutator
, org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXProperty
, org.refcodes.graphical.ViewportOffsetYAccessor
, org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYBuilder<P>
, org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYMutator
, org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYProperty
, org.refcodes.graphical.ViewportWidthAccessor
, org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthBuilder<P>
, org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthMutator
, org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthProperty
, org.refcodes.mixin.ColumnWidthAccessor
, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<P>
, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
, org.refcodes.observer.ObservableObserver<P>
public class ConsoleCheckerboardViewerImpl<P extends Player<P,S>,S> extends AbstractCheckerboardViewer<P,S,String,ConsoleSpriteFactory<S>,ConsoleCheckerboardViewer<P,S>> implements ConsoleCheckerboardViewer<P,S>
CheckerboardViewer
interface
printing the current checkerboard as good as it gets. Call
initialize()
when everything is setup correctly. When a redraw time
<= 0 is set upon construction, then the Checkerboard
is printed
out upon any according events from the underlying Checkerboard
or, in
case the refresh time is > 0 the Checkerboard
is redrawn as of the
refresh loop time. Attention: The Checkerboard
is only redrawn in
case the Checkerboard
changed compared to the last redraw process.org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B extends org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B>>, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
org.refcodes.component.Destroyable.DestroyAutomaton
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.GridHeightAccessor.GridHeightBuilder<B extends org.refcodes.graphical.GridHeightAccessor.GridHeightBuilder<B>>, org.refcodes.graphical.GridHeightAccessor.GridHeightMutator, org.refcodes.graphical.GridHeightAccessor.GridHeightProperty
org.refcodes.graphical.GridModeAccessor.GridModeBuilder<B extends org.refcodes.graphical.GridModeAccessor.GridModeBuilder<B>>, org.refcodes.graphical.GridModeAccessor.GridModeMutator, org.refcodes.graphical.GridModeAccessor.GridModeProperty
org.refcodes.graphical.GridWidthAccessor.GridWidthBuilder<B extends org.refcodes.graphical.GridWidthAccessor.GridWidthBuilder<B>>, org.refcodes.graphical.GridWidthAccessor.GridWidthMutator, org.refcodes.graphical.GridWidthAccessor.GridWidthProperty
org.refcodes.component.Initializable.InitializeAutomaton, org.refcodes.component.Initializable.InitializeBuilder<B extends org.refcodes.component.Initializable.InitializeBuilder<B>>, org.refcodes.component.Initializable.UncheckedInitializable
org.refcodes.graphical.MinViewportDimension.MinViewportDimensionBuilder<B extends org.refcodes.graphical.MinViewportDimension.MinViewportDimensionBuilder<B>>, org.refcodes.graphical.MinViewportDimension.MinViewportDimensionMutator, org.refcodes.graphical.MinViewportDimension.MinViewportDimensionProperty
org.refcodes.graphical.ViewportDimension.ViewportDimensionBuilder<B extends org.refcodes.graphical.ViewportDimension.ViewportDimensionBuilder<B>>, org.refcodes.graphical.ViewportDimension.ViewportDimensionMutator, org.refcodes.graphical.ViewportDimension.ViewportDimensionProperty
org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightBuilder<B extends org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightBuilder<B>>, org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightMutator, org.refcodes.graphical.ViewportHeightAccessor.ViewportHeightProperty
org.refcodes.graphical.ViewportOffset.ViewportOffsetBuilder<B extends org.refcodes.graphical.ViewportOffset.ViewportOffsetBuilder<B>>, org.refcodes.graphical.ViewportOffset.ViewportOffsetMutator, org.refcodes.graphical.ViewportOffset.ViewportOffsetProperty
org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXBuilder<B extends org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXBuilder<B>>, org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXMutator, org.refcodes.graphical.ViewportOffsetXAccessor.ViewportOffsetXProperty
org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYBuilder<B extends org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYBuilder<B>>, org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYMutator, org.refcodes.graphical.ViewportOffsetYAccessor.ViewportOffsetYProperty
org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthBuilder<B extends org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthBuilder<B>>, org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthMutator, org.refcodes.graphical.ViewportWidthAccessor.ViewportWidthProperty
Constructor | Description |
---|---|
ConsoleCheckerboardViewerImpl(Checkerboard<P,S> aCheckerboard,
ConsoleSpriteFactory<S> aSpriteFactory) |
Constructs the
ConsoleCheckerboardViewer with the provided
SpriteFactory creating "Sprites" (in this case String
instances) for visualizing the playground's state. |
ConsoleCheckerboardViewerImpl(Checkerboard<P,S> aCheckerboard,
ConsoleSpriteFactory<S> aSpriteFactory,
int aRedrawLoopTimeInMillis) |
Constructs the
ConsoleCheckerboardViewer with the provided
SpriteFactory creating "Sprites" (in this case String
instances) for visualizing the playground's state. |
ConsoleCheckerboardViewerImpl(Checkerboard<P,S> aCheckerboard,
ConsoleSpriteFactory<S> aSpriteFactory,
int aColumnWidth,
int aRedrawLoopTimeInMillis) |
Constructs the
ConsoleCheckerboardViewer with the provided
SpriteFactory creating "Sprites" (in this case String
instances) for visualizing the playground's state. |
Modifier and Type | Method | Description |
---|---|---|
int |
getColumnWidth() |
|
int |
getRedrawLoopTimeInMillis() |
Retrieves the refresh loop time between two redraw cycles of the
Checkerboard . |
void |
initialize() |
|
boolean |
isRedrawOnEvent() |
Determines whether the
Checkerboard is printed out upon any
according events from the underlying Checkerboard or as of the
refresh loop time (see ConsoleCheckerboardViewer.getRedrawLoopTimeInMillis() ). |
void |
onChangePositionEvent(ChangePositionEvent<P> aPlayerEvent,
Checkerboard<P,S> aSource) |
This method is called when information about an Checkerboard which was
previously requested using an asynchronous interface becomes available.
|
void |
onCheckerboardEvent(CheckerboardEvent<P,S> aCheckerboardEvent) |
This method is called when information about an Checkerboard which was
previously requested using an asynchronous interface becomes available.
|
void |
onDraggabilityChangedEvent(DraggabilityChangedEvent<P> aPlayerEvent,
Checkerboard<P,S> aSource) |
This method is called when information about an Checkerboard which was
previously requested using an asynchronous interface becomes available.
|
protected void |
onEventPrintPlayground() |
Prints the playground upon an according
Checkerboard event in
case the |
void |
onGridDimensionChangedEvent(GridDimensionChangedEvent<P,S> aCheckerboardEvent) |
This method is called when information about an Checkerboard which was
previously requested using an asynchronous interface becomes available.
|
void |
onGridModeChangedEvent(GridModeChangedEvent<P,S> aCheckerboardEvent) |
This method is called when information about an Checkerboard which was
previously requested using an asynchronous interface becomes available.
|
void |
onPlayerAddedEvent(PlayerAddedEvent<P,S> aCheckerboardEvent) |
This method is called when information about an Checkerboard which was
previously requested using an asynchronous interface becomes available.
|
void |
onPlayerEvent(PlayerEvent<P> aPlayerEvent,
Checkerboard<P,S> aSource) |
This method is called when information about an Checkerboard which was
previously requested using an asynchronous interface becomes available.
|
void |
onPlayerRemovedEvent(PlayerRemovedEvent<P,S> aCheckerboardEvent) |
This method is called when information about an Checkerboard which was
previously requested using an asynchronous interface becomes available.
|
void |
onPositionChangedEvent(PositionChangedEvent<P> aPlayerEvent,
Checkerboard<P,S> aSource) |
This method is called when information about an Checkerboard which was
previously requested using an asynchronous interface becomes available.
|
void |
onStateChangedEvent(StateChangedEvent<P,S> aPlayerEvent,
Checkerboard<P,S> aSource) |
This method is called when information about an Checkerboard which was
previously requested using an asynchronous interface becomes available.
|
void |
onViewportDimensionChangedEvent(ViewportDimensionChangedEvent<P,S> aCheckerboardEvent) |
This method is called when information about an Checkerboard which was
previously requested using an asynchronous interface becomes available.
|
void |
onViewportOffsetChangedEvent(ViewportOffsetChangedEvent<P,S> aCheckerboardEvent) |
This method is called when information about an Checkerboard which was
previously requested using an asynchronous interface becomes available.
|
void |
onVisibilityChangedEvent(VisibilityChangedEvent<P> aPlayerEvent,
Checkerboard<P,S> aSource) |
This method is called when information about an Checkerboard which was
previously requested using an asynchronous interface becomes available.
|
protected void |
printPlaygroundDaemon() |
Loops the playground printing via
printPlayground() . |
void |
setColumnWidth(int aColumnWidth) |
destroy, getCheckerboard, getGridHeight, getGridMode, getGridWidth, getMinViewportDimension, getViewportHeight, getViewportOffsetX, getViewportOffsetY, getViewportWidth, onSubscribe, onUnsubscribe, setMinViewportDimension, setMinViewportDimension, setMinViewportDimension, setViewportDimension, setViewportDimension, setViewportDimension, setViewportHeight, setViewportOffset, setViewportOffset, setViewportOffset, setViewportOffset, setViewportOffsetX, setViewportOffsetY, setViewportWidth, withInitialize, withMinViewportDimension, withMinViewportDimension, withMinViewportDimension, withViewportDimension, withViewportDimension, withViewportDimension, withViewportHeight, withViewportOffset, withViewportOffset, withViewportOffset, withViewportOffset, withViewportOffsetX, withViewportOffsetY, withViewportWidth
letColumnWidth
withColumnWidth
equals, isInBounds, isInBounds, isInHeight, isInWidth
withInitialize, withInitializeUnchecked
getMinViewportDimension
withMinViewportDimension, withMinViewportDimension, withMinViewportDimension
setMinViewportDimension, setMinViewportDimension, setMinViewportDimension
letMinViewportDimension, letMinViewportDimension, letMinViewportDimension
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onSubscribe, onUnsubscribe
withViewportDimension, withViewportDimension, withViewportDimension
setViewportDimension, setViewportDimension, setViewportDimension
withViewportHeight
setViewportHeight
letViewportHeight
withViewportOffset, withViewportOffset, withViewportOffset, withViewportOffset
setViewportOffset, setViewportOffset, setViewportOffset, setViewportOffset
withViewportOffsetX
setViewportOffsetX
letViewportOffsetX
withViewportOffsetY
setViewportOffsetY
letViewportOffsetY
withViewportWidth
public ConsoleCheckerboardViewerImpl(Checkerboard<P,S> aCheckerboard, ConsoleSpriteFactory<S> aSpriteFactory)
ConsoleCheckerboardViewer
with the provided
SpriteFactory
creating "Sprites" (in this case String
instances) for visualizing the playground's state. The
ConsoleCheckerboardViewer
is initialized with a redraw loop time
of 100 ms. Attention: The Checkerboard
is only redrawn in case
the Checkerboard
changed compared to the last redraw process.aCheckerboard
- The Checkerboard
for which to construct the
viewer.aSpriteFactory
- The SpriteFactory
to be used.public ConsoleCheckerboardViewerImpl(Checkerboard<P,S> aCheckerboard, ConsoleSpriteFactory<S> aSpriteFactory, int aRedrawLoopTimeInMillis)
ConsoleCheckerboardViewer
with the provided
SpriteFactory
creating "Sprites" (in this case String
instances) for visualizing the playground's state. The
ConsoleCheckerboardViewer
is initialized with the according
redraw loop time. When a redraw time <= 0 is set upon construction,
then the Checkerboard
is printed out upon any according events
from the underlying Checkerboard
or, in case the refresh time is
> 0 the Checkerboard
is redrawn as of the refresh loop time.
Attention: The Checkerboard
is only redrawn in case the
Checkerboard
changed compared to the last redraw process. A
default column width of 3 is configured.aRedrawLoopTimeInMillis
- The redraw loop time to work with.aCheckerboard
- The Checkerboard
for which to construct the
viewer.aSpriteFactory
- The SpriteFactory
to be used.public ConsoleCheckerboardViewerImpl(Checkerboard<P,S> aCheckerboard, ConsoleSpriteFactory<S> aSpriteFactory, int aColumnWidth, int aRedrawLoopTimeInMillis)
ConsoleCheckerboardViewer
with the provided
SpriteFactory
creating "Sprites" (in this case String
instances) for visualizing the playground's state. The
ConsoleCheckerboardViewer
is initialized with the according
redraw loop time. When a redraw time <= 0 is set upon construction,
then the Checkerboard
is printed out upon any according events
from the underlying Checkerboard
or, in case the refresh time is
> 0 the Checkerboard
is redrawn as of the refresh loop time.
Attention: The Checkerboard
is only redrawn in case the
Checkerboard
changed compared to the last redraw process.aRedrawLoopTimeInMillis
- The redraw loop time to work with.aCheckerboard
- The Checkerboard
for which to construct the
viewer.aColumnWidth
- The column width to be used when drawing the
Checkerboard
table.aSpriteFactory
- The SpriteFactory
to be used.public void initialize() throws org.refcodes.component.InitializeException
initialize
in interface org.refcodes.component.Initializable
org.refcodes.component.InitializeException
public void onCheckerboardEvent(CheckerboardEvent<P,S> aCheckerboardEvent)
onCheckerboardEvent
in interface CheckerboardObserver<P extends Player<P,S>,S>
aCheckerboardEvent
- the checkerboard eventpublic void onPlayerAddedEvent(PlayerAddedEvent<P,S> aCheckerboardEvent)
onPlayerAddedEvent
in interface CheckerboardObserver<P extends Player<P,S>,S>
aCheckerboardEvent
- the checkerboard eventpublic void onPlayerRemovedEvent(PlayerRemovedEvent<P,S> aCheckerboardEvent)
onPlayerRemovedEvent
in interface CheckerboardObserver<P extends Player<P,S>,S>
aCheckerboardEvent
- the checkerboard eventpublic void onGridModeChangedEvent(GridModeChangedEvent<P,S> aCheckerboardEvent)
onGridModeChangedEvent
in interface CheckerboardObserver<P extends Player<P,S>,S>
aCheckerboardEvent
- the checkerboard eventpublic void onGridDimensionChangedEvent(GridDimensionChangedEvent<P,S> aCheckerboardEvent)
onGridDimensionChangedEvent
in interface CheckerboardObserver<P extends Player<P,S>,S>
aCheckerboardEvent
- the checkerboard eventpublic void onViewportOffsetChangedEvent(ViewportOffsetChangedEvent<P,S> aCheckerboardEvent)
onViewportOffsetChangedEvent
in interface CheckerboardObserver<P extends Player<P,S>,S>
aCheckerboardEvent
- the checkerboard eventpublic void onViewportDimensionChangedEvent(ViewportDimensionChangedEvent<P,S> aCheckerboardEvent)
onViewportDimensionChangedEvent
in interface CheckerboardObserver<P extends Player<P,S>,S>
aCheckerboardEvent
- the checkerboard eventpublic void onPlayerEvent(PlayerEvent<P> aPlayerEvent, Checkerboard<P,S> aSource)
onPlayerEvent
in interface CheckerboardObserver<P extends Player<P,S>,S>
aPlayerEvent
- the player eventaSource
- The according source (origin).public void onChangePositionEvent(ChangePositionEvent<P> aPlayerEvent, Checkerboard<P,S> aSource) throws org.refcodes.exception.VetoException
onChangePositionEvent
in interface CheckerboardObserver<P extends Player<P,S>,S>
aPlayerEvent
- the player eventaSource
- The according source (origin).org.refcodes.exception.VetoException
- the veto exceptionpublic void onPositionChangedEvent(PositionChangedEvent<P> aPlayerEvent, Checkerboard<P,S> aSource)
onPositionChangedEvent
in interface CheckerboardObserver<P extends Player<P,S>,S>
aPlayerEvent
- the player eventaSource
- The according source (origin).public void onStateChangedEvent(StateChangedEvent<P,S> aPlayerEvent, Checkerboard<P,S> aSource)
onStateChangedEvent
in interface CheckerboardObserver<P extends Player<P,S>,S>
aPlayerEvent
- the player eventaSource
- The according source (origin).public void onVisibilityChangedEvent(VisibilityChangedEvent<P> aPlayerEvent, Checkerboard<P,S> aSource)
onVisibilityChangedEvent
in interface CheckerboardObserver<P extends Player<P,S>,S>
aPlayerEvent
- the player eventaSource
- The according source (origin).public void onDraggabilityChangedEvent(DraggabilityChangedEvent<P> aPlayerEvent, Checkerboard<P,S> aSource)
onDraggabilityChangedEvent
in interface CheckerboardObserver<P extends Player<P,S>,S>
aPlayerEvent
- the player eventaSource
- The according source (origin).public int getRedrawLoopTimeInMillis()
Checkerboard
. This is the delay time between succeeding print
outs of the Checkerboard
states to the console. If the refresh
loop time is > 0, then the Checkerboard
is redrawn at most
with intervals of the given refresh loop time. Attention: The
Checkerboard
is only redrawn in case the Checkerboard
changed compared to the last redraw process.getRedrawLoopTimeInMillis
in interface ConsoleCheckerboardViewer<P extends Player<P,S>,S>
public boolean isRedrawOnEvent()
Checkerboard
is printed out upon any
according events from the underlying Checkerboard
or as of the
refresh loop time (see ConsoleCheckerboardViewer.getRedrawLoopTimeInMillis()
). Attention:
The Checkerboard
is only redrawn in case the Checkerboard
changed compared to the last redraw process.isRedrawOnEvent
in interface ConsoleCheckerboardViewer<P extends Player<P,S>,S>
Checkerboard
is redrawn upon an event
from the Checkerboard
or upon the refresh loop time.protected void printPlaygroundDaemon()
printPlayground()
.protected void onEventPrintPlayground()
Checkerboard
event in
case thepublic int getColumnWidth()
getColumnWidth
in interface org.refcodes.mixin.ColumnWidthAccessor
public void setColumnWidth(int aColumnWidth)
setColumnWidth
in interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
Copyright © 2021. All rights reserved.