Class EventHandlerFactory


  • @Service
    public class EventHandlerFactory
    extends java.lang.Object
    Author:
    Andi Hotz, (c) Sahits GmbH, 2014 Created on Feb 16, 2014
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      IAttackListener getAttackListener​(ch.sahits.game.openpatrician.model.ship.IShip ship, PatrolInternalState state)
      Get the attack listener for a standard patrol.
      ch.sahits.game.openpatrician.display.event.handler.impl.DeliverPackages getDeliverPackagesHandler​(ch.sahits.game.openpatrician.model.city.ICity city, ch.sahits.game.openpatrician.model.ship.IShip ship, java.time.LocalDateTime deadline, int premium, int amount)
      Retrieve the event handler for delivering packages
      NextCourierPatrolStation getNextCourierPatrolStationHanlder​(ch.sahits.game.openpatrician.model.ship.IShip ship, ch.sahits.game.openpatrician.model.city.ICity city, CourierPatrolStateInternal state, ch.sahits.game.openpatrician.model.IPlayer player, java.time.LocalDateTime deadline)
      Retrieve the event handler for the next patrol station
      ch.sahits.game.openpatrician.display.event.handler.impl.NextPatrolStation getNextPatrolStation​(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship, ch.sahits.game.openpatrician.model.city.ICity city, PatrolInternalState state, ch.sahits.game.openpatrician.model.IPlayer player, java.time.LocalDateTime deadline, IAttackListener atackListener)
      Retrieve the next patrol station event listener
      ch.sahits.game.openpatrician.display.event.handler.impl.PassengerLeavesShipOnArrival getPassengerLeavingOnShipArrivalHandler​(ch.sahits.game.openpatrician.model.ship.IShip ship, ch.sahits.game.openpatrician.model.city.ICity city, ch.sahits.game.openpatrician.model.IPlayer shipsOwner, java.time.LocalDateTime deadline, ch.sahits.game.openpatrician.clientserverinterface.service.EDialogTemplateType dialogType, ch.sahits.game.openpatrician.clientserverinterface.service.DialogTemplateParameterSupplier dialogParameterSupplier, ch.sahits.game.openpatrician.clientserverinterface.service.LinearDeadlinePremiumCalculator premiumCalculator)
      Event handler for a passenger leaving the ship in a city
      ShipArrivalForLoading getShipArrivalForLoadingHandler​(ch.sahits.game.openpatrician.model.city.ICity city, ch.sahits.game.openpatrician.model.IPlayer player, java.time.LocalDateTime deadline, int requiredAmount, int premium)  
      SinkConcurrentsShipOrder getSinkConcurrentsShipOrder​(ch.sahits.game.openpatrician.model.IPlayer opponent, ch.sahits.game.openpatrician.model.IPlayer player, int offerdTime, int premium, ch.sahits.game.openpatrician.model.event.TimedTask reconciliation)
      Retrieve the concurrent ship order
      UnloadOnArrival getUnloadOnArrivalHandler​(ch.sahits.game.openpatrician.model.ship.IShip ship, ch.sahits.game.openpatrician.model.city.ICity city, int loadedAmount)
      Create the handler for unloading anonymous ware and register it with the event bus.
      ch.sahits.game.openpatrician.display.event.handler.impl.ViewChangeActionRunnable getViewChangeActionRunnable​(ch.sahits.game.openpatrician.javafx.model.EDialogType selected)
      Retrieve the event handler for a new view change runnable.
      ViewChangeDialogTemplateRunnable getViewChangeActionRunnable​(ch.sahits.game.openpatrician.model.ui.DialogTemplate template)
      Retrieve the event handler for a new dialog based on a template
      java.lang.Runnable getViewChangeActionRunnable​(ch.sahits.game.openpatrician.model.ui.IDialogState state)
      Retrieve the event handler for a new dialog based on a state
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EventHandlerFactory

        public EventHandlerFactory()
    • Method Detail

      • getDeliverPackagesHandler

        public ch.sahits.game.openpatrician.display.event.handler.impl.DeliverPackages getDeliverPackagesHandler​(ch.sahits.game.openpatrician.model.city.ICity city,
                                                                                                                 ch.sahits.game.openpatrician.model.ship.IShip ship,
                                                                                                                 java.time.LocalDateTime deadline,
                                                                                                                 int premium,
                                                                                                                 int amount)
        Retrieve the event handler for delivering packages
        Parameters:
        city - to which should be delivered
        ship - that delivers
        deadline - until the delivery has to take place
        premium - to be payed out on delivery
        amount - of the occupied space in barrels.
        Returns:
        event handler for delivering packages.
      • getShipArrivalForLoadingHandler

        public ShipArrivalForLoading getShipArrivalForLoadingHandler​(ch.sahits.game.openpatrician.model.city.ICity city,
                                                                     ch.sahits.game.openpatrician.model.IPlayer player,
                                                                     java.time.LocalDateTime deadline,
                                                                     int requiredAmount,
                                                                     int premium)
      • getPassengerLeavingOnShipArrivalHandler

        public ch.sahits.game.openpatrician.display.event.handler.impl.PassengerLeavesShipOnArrival getPassengerLeavingOnShipArrivalHandler​(ch.sahits.game.openpatrician.model.ship.IShip ship,
                                                                                                                                            ch.sahits.game.openpatrician.model.city.ICity city,
                                                                                                                                            ch.sahits.game.openpatrician.model.IPlayer shipsOwner,
                                                                                                                                            java.time.LocalDateTime deadline,
                                                                                                                                            ch.sahits.game.openpatrician.clientserverinterface.service.EDialogTemplateType dialogType,
                                                                                                                                            ch.sahits.game.openpatrician.clientserverinterface.service.DialogTemplateParameterSupplier dialogParameterSupplier,
                                                                                                                                            ch.sahits.game.openpatrician.clientserverinterface.service.LinearDeadlinePremiumCalculator premiumCalculator)
        Event handler for a passenger leaving the ship in a city
        Parameters:
        ship - that is left
        city - destination
        shipsOwner - owner of the ship
        deadline - after which the passenger leaves without premium
        dialogType - enum type identifying the dialog that is to be created.
        dialogParameterSupplier - supplier function providing the arguments for the dialog template.
        premiumCalculator - supplier lambda function to calculate the premium to be payed upon arrival.
        Returns:
        bean handling the passenger leaving the ship on arrival at the destination.
      • getUnloadOnArrivalHandler

        public UnloadOnArrival getUnloadOnArrivalHandler​(ch.sahits.game.openpatrician.model.ship.IShip ship,
                                                         ch.sahits.game.openpatrician.model.city.ICity city,
                                                         int loadedAmount)
        Create the handler for unloading anonymous ware and register it with the event bus.
        Parameters:
        ship - ship that has the ware loaded
        city - into which the ship should arrive
        loadedAmount - amount of anonymous ware loaded.
        Returns:
        Event handler for arrivals
      • getNextCourierPatrolStationHanlder

        public NextCourierPatrolStation getNextCourierPatrolStationHanlder​(ch.sahits.game.openpatrician.model.ship.IShip ship,
                                                                           ch.sahits.game.openpatrician.model.city.ICity city,
                                                                           CourierPatrolStateInternal state,
                                                                           ch.sahits.game.openpatrician.model.IPlayer player,
                                                                           java.time.LocalDateTime deadline)
        Retrieve the event handler for the next patrol station
        Parameters:
        ship - that is on patrol
        city - next city
        state - patrol state
        player - for which to create the next courier patrol station
        deadline - until the patrol has to reach the city
        Returns:
        next patrol station for the courier
      • getViewChangeActionRunnable

        public ch.sahits.game.openpatrician.display.event.handler.impl.ViewChangeActionRunnable getViewChangeActionRunnable​(ch.sahits.game.openpatrician.javafx.model.EDialogType selected)
        Retrieve the event handler for a new view change runnable.
        Parameters:
        selected - notice item that is selected.
        Returns:
        new instance of a view changable runnable.
      • getViewChangeActionRunnable

        public ViewChangeDialogTemplateRunnable getViewChangeActionRunnable​(ch.sahits.game.openpatrician.model.ui.DialogTemplate template)
        Retrieve the event handler for a new dialog based on a template
        Parameters:
        template - dialog template to inject into the view changable
        Returns:
        new view changable based on a dialog template
      • getViewChangeActionRunnable

        public java.lang.Runnable getViewChangeActionRunnable​(ch.sahits.game.openpatrician.model.ui.IDialogState state)
        Retrieve the event handler for a new dialog based on a state
        Parameters:
        state - dialog state for the vhiew change dialog runnable
        Returns:
        new instance of a view change runable based on a dialog state
      • getAttackListener

        public IAttackListener getAttackListener​(ch.sahits.game.openpatrician.model.ship.IShip ship,
                                                 PatrolInternalState state)
        Get the attack listener for a standard patrol.
        Parameters:
        ship - doing the patrol
        state - patrol state
        Returns:
        new instance of an attack listener
      • getNextPatrolStation

        public ch.sahits.game.openpatrician.display.event.handler.impl.NextPatrolStation getNextPatrolStation​(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship,
                                                                                                              ch.sahits.game.openpatrician.model.city.ICity city,
                                                                                                              PatrolInternalState state,
                                                                                                              ch.sahits.game.openpatrician.model.IPlayer player,
                                                                                                              java.time.LocalDateTime deadline,
                                                                                                              IAttackListener atackListener)
        Retrieve the next patrol station event listener
        Parameters:
        ship - doing the patrrol
        city - next city
        state - current state
        player - for which to create the next patrol station
        deadline - until when the city has to be reached
        atackListener - listener for attacks
        Returns:
        new instance of the next station on a patrol
      • getSinkConcurrentsShipOrder

        public SinkConcurrentsShipOrder getSinkConcurrentsShipOrder​(ch.sahits.game.openpatrician.model.IPlayer opponent,
                                                                    ch.sahits.game.openpatrician.model.IPlayer player,
                                                                    int offerdTime,
                                                                    int premium,
                                                                    ch.sahits.game.openpatrician.model.event.TimedTask reconciliation)
        Retrieve the concurrent ship order
        Parameters:
        opponent - player
        player - the order executor
        offerdTime - time to execute the task
        premium - on successful execution
        reconciliation - timer task for the reconcialiation
        Returns:
        new instance of an order to sing a concurrents ship.