P
- the generic typeS
- the generic typeCheckerboard<P,S>
, Players<P>
, org.refcodes.component.Component
, org.refcodes.component.Destroyable
, org.refcodes.graphical.GridDimension
, org.refcodes.graphical.GridDimension.GridDimensionBuilder<Checkerboard<P,S>>
, org.refcodes.graphical.GridDimension.GridDimensionMutator
, org.refcodes.graphical.GridDimension.GridDimensionProperty
, org.refcodes.graphical.GridHeightAccessor
, org.refcodes.graphical.GridHeightAccessor.GridHeightBuilder<Checkerboard<P,S>>
, org.refcodes.graphical.GridHeightAccessor.GridHeightMutator
, org.refcodes.graphical.GridHeightAccessor.GridHeightProperty
, org.refcodes.graphical.GridModeAccessor
, org.refcodes.graphical.GridModeAccessor.GridModeBuilder<Checkerboard<P,S>>
, org.refcodes.graphical.GridModeAccessor.GridModeMutator
, org.refcodes.graphical.GridModeAccessor.GridModeProperty
, org.refcodes.graphical.GridWidthAccessor
, org.refcodes.graphical.GridWidthAccessor.GridWidthBuilder<Checkerboard<P,S>>
, org.refcodes.graphical.GridWidthAccessor.GridWidthMutator
, org.refcodes.graphical.GridWidthAccessor.GridWidthProperty
, org.refcodes.mixin.Disposable
, org.refcodes.mixin.Loggable
, org.refcodes.observer.Observable<CheckerboardObserver<P,S>>
public class CheckerboardImpl<P extends Player<P,S>,S> extends org.refcodes.observer.AbstractObservable<CheckerboardObserver<P,S>,org.refcodes.observer.GenericEvent<?>> implements Checkerboard<P,S>
org.refcodes.component.Destroyable.DestroyAutomaton
org.refcodes.mixin.Disposable.Disposedable
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
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
Constructor | Description |
---|---|
CheckerboardImpl() |
Modifier and Type | Method | Description |
---|---|---|
P |
atBottomLeftOf(org.refcodes.graphical.Position aPos) |
At bottom left of.
|
P |
atBottomOf(org.refcodes.graphical.Position aPos) |
At bottom of.
|
P |
atBottomRightOf(org.refcodes.graphical.Position aPos) |
At bottom right of.
|
P |
atLeftOf(org.refcodes.graphical.Position aPos) |
At left of.
|
P |
atPosition(int aPosX,
int aPosY) |
At position.
|
P |
atPosition(org.refcodes.graphical.Position aPos) |
At position.
|
P |
atRightOf(org.refcodes.graphical.Position aPos) |
At right of.
|
P |
atTopLeftOf(org.refcodes.graphical.Position aPos) |
At top left of.
|
P |
atTopOf(org.refcodes.graphical.Position aPos) |
At top of.
|
P |
atTopRightOf(org.refcodes.graphical.Position aPos) |
At top right of.
|
void |
clearPlayers() |
Clear players.
|
void |
destroy() |
|
protected boolean |
fireEvent(org.refcodes.observer.GenericEvent<?> aEvent,
CheckerboardObserver<P,S> aObserver,
org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) |
Fire event.
|
void |
forEach(Consumer<P> aConsumer) |
Performs the given action for each
Player on the
Checkerboard until all players have been processed or the action
throws an exception. |
Map<Integer,P> |
getColumn(int aColumn) |
Gets the column.
|
int |
getGridHeight() |
|
org.refcodes.graphical.GridMode |
getGridMode() |
|
int |
getGridWidth() |
|
List<P> |
getPlayers() |
Gets the players.
|
Map<Integer,P> |
getRow(int aRow) |
Gets the row.
|
boolean |
hasAtBottomLeftOf(org.refcodes.graphical.Position aPos) |
Checks for at bottom left of.
|
boolean |
hasAtBottomOf(org.refcodes.graphical.Position aPos) |
Checks for at bottom of.
|
boolean |
hasAtBottomRightOf(org.refcodes.graphical.Position aPos) |
Checks for at bottom right of.
|
boolean |
hasAtLeftOf(org.refcodes.graphical.Position aPos) |
Checks for at left of.
|
boolean |
hasAtPosition(int aPosX,
int aPosY) |
Checks for at position.
|
boolean |
hasAtPosition(org.refcodes.graphical.Position aPos) |
Checks for at position.
|
boolean |
hasAtRightOf(org.refcodes.graphical.Position aPos) |
Checks for at right of.
|
boolean |
hasAtTopLeftOf(org.refcodes.graphical.Position aPos) |
Checks for at top left of.
|
boolean |
hasAtTopOf(org.refcodes.graphical.Position aPos) |
Checks for at top of.
|
boolean |
hasAtTopRightOf(org.refcodes.graphical.Position aPos) |
Checks for at top right of.
|
boolean |
hasPlayer(P aPlayer) |
Checks for player.
|
boolean |
hasPlayers() |
Checks for players.
|
int |
playerCount() |
Player count.
|
Iterator<P> |
players() |
Players.
|
P |
putPlayer(P aPlayer) |
Put player.
|
boolean |
removePlayer(P aPlayer) |
Removes the player.
|
void |
setGridDimension(int aWidth,
int aHeight) |
|
void |
setGridDimension(org.refcodes.graphical.Dimension aDimension) |
|
void |
setGridDimension(org.refcodes.graphical.GridDimension aDimension) |
|
void |
setGridHeight(int aHeight) |
|
void |
setGridMode(org.refcodes.graphical.GridMode aGridMode) |
|
void |
setGridWidth(int aWidth) |
|
boolean |
subscribeObserver(CheckerboardObserver<P,S> aObserver) |
|
boolean |
unsubscribeObserver(CheckerboardObserver<P,S> aObserver) |
|
Checkerboard<P,S> |
withGridDimension(int aGridWidth,
int aGridHeight) |
|
Checkerboard<P,S> |
withGridDimension(org.refcodes.graphical.Dimension aDimension) |
|
Checkerboard<P,S> |
withGridDimension(org.refcodes.graphical.GridDimension aDimension) |
|
Checkerboard<P,S> |
withGridHeight(int aHeight) |
|
Checkerboard<P,S> |
withGridMode(org.refcodes.graphical.GridMode aGridMode) |
|
Checkerboard<P,S> |
withGridWidth(int aWidth) |
clear, dispose, doHandleEventListenerException, fireEvent, getThreadPriority, hasObserverSubscription, isEmpty, isObserversActive, observers, setObserversActive, setThreadPriority, size
isInBounds, isInBounds, isInHeight, isInWidth
alert, alert, critical, critical, debug, error, info, notice, panic, trace, warn, warn
public Checkerboard<P,S> withGridMode(org.refcodes.graphical.GridMode aGridMode)
public Checkerboard<P,S> withGridDimension(int aGridWidth, int aGridHeight)
public Checkerboard<P,S> withGridDimension(org.refcodes.graphical.GridDimension aDimension)
public Checkerboard<P,S> withGridDimension(org.refcodes.graphical.Dimension aDimension)
public Checkerboard<P,S> withGridWidth(int aWidth)
public Checkerboard<P,S> withGridHeight(int aHeight)
public void forEach(Consumer<P> aConsumer)
Player
on the
Checkerboard
until all players have been processed or the action
throws an exception.public boolean hasAtPosition(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
hasAtPosition
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic boolean hasAtPosition(int aPosX, int aPosY) throws IndexOutOfBoundsException
hasAtPosition
in interface Checkerboard<P extends Player<P,S>,S>
aPosX
- the pos XaPosY
- the pos YIndexOutOfBoundsException
- the index out of bounds exceptionpublic P atPosition(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
atPosition
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic P atPosition(int aPosX, int aPosY) throws IndexOutOfBoundsException
atPosition
in interface Checkerboard<P extends Player<P,S>,S>
aPosX
- the pos XaPosY
- the pos YIndexOutOfBoundsException
- the index out of bounds exceptionpublic boolean hasAtTopOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
hasAtTopOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic P atTopOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
atTopOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic boolean hasAtTopRightOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
hasAtTopRightOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic P atTopRightOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
atTopRightOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic boolean hasAtRightOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
hasAtRightOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic P atRightOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
atRightOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic boolean hasAtBottomRightOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
hasAtBottomRightOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic P atBottomRightOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
atBottomRightOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic boolean hasAtBottomOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
hasAtBottomOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic P atBottomOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
atBottomOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic boolean hasAtBottomLeftOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
hasAtBottomLeftOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic P atBottomLeftOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
atBottomLeftOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic boolean hasAtLeftOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
hasAtLeftOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic P atLeftOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
atLeftOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic boolean hasAtTopLeftOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
hasAtTopLeftOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic P atTopLeftOf(org.refcodes.graphical.Position aPos) throws IndexOutOfBoundsException
atTopLeftOf
in interface Checkerboard<P extends Player<P,S>,S>
aPos
- the posIndexOutOfBoundsException
- the index out of bounds exceptionpublic Map<Integer,P> getRow(int aRow) throws IndexOutOfBoundsException
getRow
in interface Checkerboard<P extends Player<P,S>,S>
aRow
- the rowIndexOutOfBoundsException
- the index out of bounds exceptionpublic Map<Integer,P> getColumn(int aColumn) throws IndexOutOfBoundsException
getColumn
in interface Checkerboard<P extends Player<P,S>,S>
aColumn
- the columnIndexOutOfBoundsException
- the index out of bounds exceptionpublic org.refcodes.graphical.GridMode getGridMode()
getGridMode
in interface org.refcodes.graphical.GridModeAccessor
public void setGridMode(org.refcodes.graphical.GridMode aGridMode)
setGridMode
in interface org.refcodes.graphical.GridModeAccessor.GridModeMutator
public boolean removePlayer(P aPlayer)
public void clearPlayers()
public int playerCount()
public boolean hasPlayers()
public boolean hasPlayer(P aPlayer)
public int getGridWidth()
getGridWidth
in interface org.refcodes.graphical.GridWidthAccessor
public void setGridDimension(int aWidth, int aHeight)
setGridDimension
in interface org.refcodes.graphical.GridDimension.GridDimensionMutator
public void setGridDimension(org.refcodes.graphical.GridDimension aDimension)
setGridDimension
in interface org.refcodes.graphical.GridDimension.GridDimensionMutator
public void setGridDimension(org.refcodes.graphical.Dimension aDimension)
setGridDimension
in interface org.refcodes.graphical.GridDimension.GridDimensionMutator
public void setGridWidth(int aWidth)
setGridWidth
in interface org.refcodes.graphical.GridWidthAccessor.GridWidthMutator
public void setGridHeight(int aHeight)
setGridHeight
in interface org.refcodes.graphical.GridHeightAccessor.GridHeightMutator
public int getGridHeight()
getGridHeight
in interface org.refcodes.graphical.GridHeightAccessor
public boolean subscribeObserver(CheckerboardObserver<P,S> aObserver)
public boolean unsubscribeObserver(CheckerboardObserver<P,S> aObserver)
public void destroy()
destroy
in interface org.refcodes.component.Destroyable
protected boolean fireEvent(org.refcodes.observer.GenericEvent<?> aEvent, CheckerboardObserver<P,S> aObserver, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) throws org.refcodes.exception.VetoException
fireEvent
in class org.refcodes.observer.AbstractObservable<CheckerboardObserver<P extends Player<P,S>,S>,org.refcodes.observer.GenericEvent<?>>
aEvent
- the eventaObserver
- the observeraExecutionStrategy
- the execution strategyorg.refcodes.exception.VetoException
- the veto exceptionCopyright © 2018. All rights reserved.