Class AbstractPlayer<P extends Player<P,S>,S>

java.lang.Object
org.refcodes.observer.AbstractObservable<PlayerObserver<P,S>,PlayerEvent<P>>
org.refcodes.checkerboard.AbstractPlayer<P,S>
Type Parameters:
P - the generic type
S - the generic type
All Implemented Interfaces:
Player<P,S>, org.refcodes.graphical.DraggableAccessor, org.refcodes.graphical.DraggableAccessor.DraggableBuilder<P>, org.refcodes.graphical.DraggableAccessor.DraggableMutator, org.refcodes.graphical.DraggableAccessor.DraggableProperty, org.refcodes.graphical.Position, org.refcodes.graphical.Position.PositionBuilder<P>, org.refcodes.graphical.Position.PositionMutator, org.refcodes.graphical.Position.PositionProperty, org.refcodes.graphical.PosXAccessor, org.refcodes.graphical.PosXAccessor.PosXBuilder<P>, org.refcodes.graphical.PosXAccessor.PosXMutator, org.refcodes.graphical.PosXAccessor.PosXProperty, org.refcodes.graphical.PosYAccessor, org.refcodes.graphical.PosYAccessor.PosYBuilder<P>, org.refcodes.graphical.PosYAccessor.PosYMutator, org.refcodes.graphical.PosYAccessor.PosYProperty, org.refcodes.graphical.VisibleAccessor, org.refcodes.graphical.VisibleAccessor.VisibleBuilder<P>, org.refcodes.graphical.VisibleAccessor.VisibleMutator, org.refcodes.graphical.VisibleAccessor.VisibleProperty, org.refcodes.mixin.Disposable, org.refcodes.mixin.Loggable, org.refcodes.mixin.StatusAccessor<S>, org.refcodes.mixin.StatusAccessor.StatusBuilder<S,P>, org.refcodes.mixin.StatusAccessor.StatusMutator<S>, org.refcodes.mixin.StatusAccessor.StatusProperty<S>, org.refcodes.observer.Observable<PlayerObserver<P,S>>
Direct Known Subclasses:
Meeple

public abstract class AbstractPlayer<P extends Player<P,S>,S> extends org.refcodes.observer.AbstractObservable<PlayerObserver<P,S>,PlayerEvent<P>> implements Player<P,S>
The Class AbstractPlayer.
  • Nested Class Summary

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

    org.refcodes.graphical.DraggableAccessor.DraggableBuilder<B extends org.refcodes.graphical.DraggableAccessor.DraggableBuilder<B>>, org.refcodes.graphical.DraggableAccessor.DraggableMutator, org.refcodes.graphical.DraggableAccessor.DraggableProperty

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

    org.refcodes.graphical.Position.PositionBuilder<B extends org.refcodes.graphical.Position.PositionBuilder<B>>, org.refcodes.graphical.Position.PositionMutator, org.refcodes.graphical.Position.PositionProperty

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

    org.refcodes.graphical.PosXAccessor.PosXBuilder<B extends org.refcodes.graphical.PosXAccessor.PosXBuilder<B>>, org.refcodes.graphical.PosXAccessor.PosXMutator, org.refcodes.graphical.PosXAccessor.PosXProperty

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

    org.refcodes.graphical.PosYAccessor.PosYBuilder<B extends org.refcodes.graphical.PosYAccessor.PosYBuilder<B>>, org.refcodes.graphical.PosYAccessor.PosYMutator, org.refcodes.graphical.PosYAccessor.PosYProperty

    Nested classes/interfaces inherited from interface org.refcodes.mixin.StatusAccessor

    org.refcodes.mixin.StatusAccessor.StatusBuilder<S extends Object,B extends org.refcodes.mixin.StatusAccessor.StatusBuilder<S,B>>, org.refcodes.mixin.StatusAccessor.StatusMutator<S extends Object>, org.refcodes.mixin.StatusAccessor.StatusProperty<S extends Object>

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

    org.refcodes.graphical.VisibleAccessor.VisibleBuilder<B extends org.refcodes.graphical.VisibleAccessor.VisibleBuilder<B>>, org.refcodes.graphical.VisibleAccessor.VisibleMutator, org.refcodes.graphical.VisibleAccessor.VisibleProperty
  • Field Summary

    Fields inherited from interface org.refcodes.mixin.Loggable

    RUNTIME_LOGGER_CLASS, RUNTIME_LOGGER_FACTORY_CLASS, RUNTIME_LOGGER_FACTORY_METHOD
  • Constructor Summary

    Constructors
    Constructor
    Description
    Empty constructor.
    AbstractPlayer(int aPosX, int aPosY)
    Instantiates a new abstract player.
    AbstractPlayer(org.refcodes.graphical.Position aPosition)
    Instantiates a new abstract player.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Selects ("clicks") the player.
    void
    protected boolean
    fireEvent(PlayerEvent<P> aEvent, PlayerObserver<P,S> aObserver, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
    Fire event.
    int
    int
    void
    boolean
    boolean
    void
    setDraggable(boolean isDraggable)
    Sets the draggable.
    void
    setPosition(int aPosX, int aPosY)
    Sets the position.
    void
    setPosition(org.refcodes.graphical.Position aPosition)
    void
    setPositionX(int aPosX)
    Sets the position X.
    void
    setPositionY(int aPosY)
    Sets the position Y.
    void
    setStatus(S aState)
    Sets the state.
    void
    setVisible(boolean isVisible)
    Sets the visible.
    void
    void
    With draggable.
    withDraggable(boolean isDraggable)
    With draggable.
    With hide.
    withPosition(int aPosX, int aPosY)
    With position.
    withPosition(org.refcodes.graphical.Position aPosition)
    With position.
    withPositionX(int aPosX)
    With position X.
    withPositionY(int aPosY)
    With position Y.
    With show.
    With stationary.
    withStatus(S aState)
    With state.
    withVisible(boolean isVisible)
    With visible.

    Methods inherited from class org.refcodes.observer.AbstractObservable

    clear, dispose, doHandleEventListenerException, fireEvent, getThreadPriority, hasObserverSubscription, isEmpty, isObserversActive, observers, setObserversActive, setThreadPriority, size, subscribeObserver, unsubscribeObserver

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.refcodes.graphical.DraggableAccessor.DraggableProperty

    letDraggable

    Methods inherited from interface org.refcodes.mixin.Loggable

    alert, alert, critical, critical, debug, error, info, notice, panic, trace, warn, warn

    Methods inherited from interface org.refcodes.observer.Observable

    hasObserverSubscription, subscribeObserver, unsubscribeObserver

    Methods inherited from interface org.refcodes.graphical.Position

    toAddTo, toSubFrom

    Methods inherited from interface org.refcodes.graphical.Position.PositionProperty

    addTo, letPosition, letPosition, subFrom

    Methods inherited from interface org.refcodes.graphical.PosXAccessor.PosXProperty

    letPositionX

    Methods inherited from interface org.refcodes.graphical.PosYAccessor.PosYProperty

    letPositionY

    Methods inherited from interface org.refcodes.mixin.StatusAccessor.StatusProperty

    letStatus

    Methods inherited from interface org.refcodes.graphical.VisibleAccessor.VisibleProperty

    letVisible
  • Constructor Details

    • AbstractPlayer

      public AbstractPlayer()
      Empty constructor. Make sure you set the coordinates e.g. by calling setPosition(int, int) or the like after construction. You may also directly construct with coordinates by using AbstractPlayer(Position) or AbstractPlayer(int, int).
    • AbstractPlayer

      public AbstractPlayer(int aPosX, int aPosY)
      Instantiates a new abstract player.
      Parameters:
      aPosX - the pos X
      aPosY - the pos Y
    • AbstractPlayer

      public AbstractPlayer(org.refcodes.graphical.Position aPosition)
      Instantiates a new abstract player.
      Parameters:
      aPosition - the position
  • Method Details

    • click

      public void click()
      Selects ("clicks") the player.
      Specified by:
      click in interface Player<P extends Player<P,S>,S>
    • withPosition

      public P withPosition(int aPosX, int aPosY) throws org.refcodes.exception.VetoException.VetoRuntimeException
      With position.
      Specified by:
      withPosition in interface org.refcodes.graphical.Position.PositionBuilder<P extends Player<P,S>>
      Parameters:
      aPosX - the pos X
      aPosY - the pos Y
      Returns:
      the p
      Throws:
      org.refcodes.exception.VetoException.VetoRuntimeException - the veto runtime exception
    • withPosition

      public P withPosition(org.refcodes.graphical.Position aPosition) throws org.refcodes.exception.VetoException.VetoRuntimeException
      With position.
      Specified by:
      withPosition in interface org.refcodes.graphical.Position.PositionBuilder<P extends Player<P,S>>
      Parameters:
      aPosition - the position
      Returns:
      the p
      Throws:
      org.refcodes.exception.VetoException.VetoRuntimeException - the veto runtime exception
    • setPosition

      public void setPosition(int aPosX, int aPosY) throws org.refcodes.exception.VetoException.VetoRuntimeException
      Sets the position.
      Specified by:
      setPosition in interface org.refcodes.graphical.Position.PositionMutator
      Parameters:
      aPosX - the pos X
      aPosY - the pos Y
      Throws:
      org.refcodes.exception.VetoException.VetoRuntimeException - the veto runtime exception
    • setPosition

      public void setPosition(org.refcodes.graphical.Position aPosition) throws org.refcodes.exception.VetoException.VetoRuntimeException
      Specified by:
      setPosition in interface org.refcodes.graphical.Position.PositionMutator
      Throws:
      org.refcodes.exception.VetoException.VetoRuntimeException
    • withPositionY

      public P withPositionY(int aPosY) throws org.refcodes.exception.VetoException.VetoRuntimeException
      With position Y.
      Specified by:
      withPositionY in interface org.refcodes.graphical.PosYAccessor.PosYBuilder<P extends Player<P,S>>
      Parameters:
      aPosY - the pos Y
      Returns:
      the p
      Throws:
      org.refcodes.exception.VetoException.VetoRuntimeException - the veto runtime exception
    • setPositionY

      public void setPositionY(int aPosY) throws org.refcodes.exception.VetoException.VetoRuntimeException
      Sets the position Y.
      Specified by:
      setPositionY in interface org.refcodes.graphical.PosYAccessor.PosYMutator
      Parameters:
      aPosY - the new position Y
      Throws:
      org.refcodes.exception.VetoException.VetoRuntimeException - the veto runtime exception
    • withPositionX

      public P withPositionX(int aPosX) throws org.refcodes.exception.VetoException.VetoRuntimeException
      With position X.
      Specified by:
      withPositionX in interface org.refcodes.graphical.PosXAccessor.PosXBuilder<P extends Player<P,S>>
      Parameters:
      aPosX - the pos X
      Returns:
      the p
      Throws:
      org.refcodes.exception.VetoException.VetoRuntimeException - the veto runtime exception
    • setStatus

      public void setStatus(S aState)
      Sets the state.
      Specified by:
      setStatus in interface org.refcodes.mixin.StatusAccessor.StatusMutator<P extends Player<P,S>>
      Parameters:
      aState - the new state
    • withStatus

      public P withStatus(S aState)
      With state.
      Specified by:
      withStatus in interface org.refcodes.mixin.StatusAccessor.StatusBuilder<P extends Player<P,S>,S>
      Parameters:
      aState - the state
      Returns:
      the p
    • setPositionX

      public void setPositionX(int aPosX)
      Sets the position X.
      Specified by:
      setPositionX in interface org.refcodes.graphical.PosXAccessor.PosXMutator
      Parameters:
      aPosX - the new position X
    • setVisible

      public void setVisible(boolean isVisible)
      Sets the visible.
      Specified by:
      setVisible in interface org.refcodes.graphical.VisibleAccessor.VisibleMutator
      Parameters:
      isVisible - the new visible
    • withShow

      public P withShow()
      With show.
      Specified by:
      withShow in interface org.refcodes.graphical.VisibleAccessor.VisibleBuilder<P extends Player<P,S>>
      Returns:
      the p
    • withHide

      public P withHide()
      With hide.
      Specified by:
      withHide in interface org.refcodes.graphical.VisibleAccessor.VisibleBuilder<P extends Player<P,S>>
      Returns:
      the p
    • withVisible

      public P withVisible(boolean isVisible)
      With visible.
      Specified by:
      withVisible in interface org.refcodes.graphical.VisibleAccessor.VisibleBuilder<P extends Player<P,S>>
      Parameters:
      isVisible - the is visible
      Returns:
      the p
    • show

      public void show()
      Specified by:
      show in interface org.refcodes.graphical.VisibleAccessor.VisibleMutator
    • hide

      public void hide()
      Specified by:
      hide in interface org.refcodes.graphical.VisibleAccessor.VisibleMutator
    • isVisible

      public boolean isVisible()
      Specified by:
      isVisible in interface org.refcodes.graphical.VisibleAccessor
    • setDraggable

      public void setDraggable(boolean isDraggable)
      Sets the draggable.
      Specified by:
      setDraggable in interface org.refcodes.graphical.DraggableAccessor.DraggableMutator
      Parameters:
      isDraggable - the new draggable
    • withDraggable

      public P withDraggable()
      With draggable.
      Specified by:
      withDraggable in interface org.refcodes.graphical.DraggableAccessor.DraggableBuilder<P extends Player<P,S>>
      Returns:
      the p
    • withStationary

      public P withStationary()
      With stationary.
      Specified by:
      withStationary in interface org.refcodes.graphical.DraggableAccessor.DraggableBuilder<P extends Player<P,S>>
      Returns:
      the p
    • withDraggable

      public P withDraggable(boolean isDraggable)
      With draggable.
      Specified by:
      withDraggable in interface org.refcodes.graphical.DraggableAccessor.DraggableBuilder<P extends Player<P,S>>
      Parameters:
      isDraggable - the is draggable
      Returns:
      the p
    • draggable

      public void draggable()
      Specified by:
      draggable in interface org.refcodes.graphical.DraggableAccessor.DraggableMutator
    • stationary

      public void stationary()
      Specified by:
      stationary in interface org.refcodes.graphical.DraggableAccessor.DraggableMutator
    • isDraggable

      public boolean isDraggable()
      Specified by:
      isDraggable in interface org.refcodes.graphical.DraggableAccessor
    • getPositionX

      public int getPositionX()
      Specified by:
      getPositionX in interface org.refcodes.graphical.PosXAccessor
    • getPositionY

      public int getPositionY()
      Specified by:
      getPositionY in interface org.refcodes.graphical.PosYAccessor
    • getStatus

      public S getStatus()
      Specified by:
      getStatus in interface org.refcodes.mixin.StatusAccessor<P extends Player<P,S>>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • fireEvent

      protected boolean fireEvent(PlayerEvent<P> aEvent, PlayerObserver<P,S> aObserver, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) throws org.refcodes.exception.VetoException
      Fire event.
      Specified by:
      fireEvent in class org.refcodes.observer.AbstractObservable<PlayerObserver<P extends Player<P,S>,S>,PlayerEvent<P extends Player<P,S>>>
      Parameters:
      aEvent - the event
      aObserver - the observer
      aExecutionStrategy - the execution strategy
      Returns:
      true, if successful
      Throws:
      org.refcodes.exception.VetoException - the veto exception