Class AbstractPlayer<P extends Player<P,S>,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.StatusAccessor<P>, org.refcodes.mixin.StatusAccessor.StatusBuilder<P,S>, org.refcodes.mixin.StatusAccessor.StatusMutator<P>, org.refcodes.mixin.StatusAccessor.StatusProperty<P>, org.refcodes.observer.Observable<P>
    Direct Known Subclasses:
    TaitoImpl


    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.mixin.Disposable

        org.refcodes.mixin.Disposable.Disposedable
      • 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, org.refcodes.graphical.Position.PositionPropertyBuilder
      • 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 java.lang.Object,B extends org.refcodes.mixin.StatusAccessor.StatusBuilder<S,B>>, org.refcodes.mixin.StatusAccessor.StatusMutator<S extends java.lang.Object>, org.refcodes.mixin.StatusAccessor.StatusProperty<S extends java.lang.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
      AbstractPlayer​()
      Empty constructor.
      AbstractPlayer​(int aPosX, int aPosY)
      Instantiates a new abstract player.
      AbstractPlayer​(org.refcodes.graphical.Position aPosition)
      Instantiates a new abstract player.
    • Constructor Detail

      • 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 Detail

      • 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 java.lang.String toString​()
        Overrides:
        toString in class java.lang.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