Interface IShipyard

  • All Known Implementing Classes:
    ShipyardState

    public interface IShipyard
    Interface defining the model of the ship yard.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2013 Created on Mar 9, 2013
    • Method Detail

      • getCity

        ICity getCity()
        Retrieve the city the shipyard belongs to.
        Returns:
        city to which the shipyard is assigned.
      • getShipBuildingList

        java.util.List<IShipDueDate> getShipBuildingList()
        Retrieve an immutable list of the ships that are ordered to be built on this shipyard.
        Returns:
        immutable list of ship due dates.
      • getBuildCompleteDate

        java.time.LocalDateTime getBuildCompleteDate​(EShipType type)
        Retrieve the date when the building of a new ship will be finished.
        Parameters:
        type - of the ship to be built
        Returns:
        end date of the building
      • addShipBuildingOrder

        void addShipBuildingOrder​(IShipDueDate dueDate,
                                  java.util.Optional<TimedTask> task)
        Add an order for building a new ship to the list.
        Parameters:
        dueDate - when the ship is finished building
        task - that is executed on completion.
      • addShipRepairOrder

        void addShipRepairOrder​(IShipDueDate dueDate,
                                java.util.Optional<TimedTask> task)
        Add an order for repairing a ship to the list.
        Parameters:
        dueDate - when the ship is finished repairing
        task - that is executed on completion.
      • addShipRefitOrder

        void addShipRefitOrder​(IShipDueDate dueDate,
                               java.util.Optional<TimedTask> task)
        Add an order for refitting a ship to the list.
        Parameters:
        dueDate - when the ship is refitted
        task - that is executed on completion.
      • cancelShipBuildingOrder

        void cancelShipBuildingOrder​(java.time.LocalDateTime finish)
        Cancel the order of the building, finished on the given date.
        Parameters:
        finish - date
      • getShipRepairList

        java.util.List<IShipDueDate> getShipRepairList()
        Retrieve the list of all ships that are to be repaired.
        Returns:
        immutable list of all the repairing ships
      • getShipUpgradeList

        java.util.List<IShipDueDate> getShipUpgradeList()
        Retrieve the list of all ships that are to be upgraded.
        Returns:
        immutable list of all the upgrading ships
      • cancelRepair

        void cancelRepair​(IShip ship)
        Cancel the repair of the ship. No damage will be repaired
        Parameters:
        ship - which's repair order is to be canceled
      • calculateRepairCosts

        int calculateRepairCosts​(int repairTime,
                                 int materialCosts)
        Calculate the repair costs.
        Parameters:
        repairTime - number of days it takes for the repair
        materialCosts - costs of material that are required to be bought
        Returns:
        total cost of the repair.
      • calculateRepairMaterialCosts

        int calculateRepairMaterialCosts​(IShip ship,
                                         int damage)
        Calculate the material costs for the repair.
        Parameters:
        ship - for which to calculate the material costs.
        damage - of the ship
        Returns:
        total material costs.
      • calculateRefitCosts

        int calculateRefitCosts​(EShipType type,
                                int levels)
        Calculate the labor costs for the refit based on the ship type and how many levels should be upgraded.
        Parameters:
        type - ship type that should be upgraded
        levels - number of upgrade levels
        Returns:
        total work costs for the refit.
      • calculateRefitTime

        int calculateRefitTime​(EShipType type)
        Calculate the time in days it takes for refitting.
        Parameters:
        type - destination level
        Returns:
        time in days.
      • getBuildableShipTypes

        EShipType[] getBuildableShipTypes()
        Retrieve a list of all the types of ships this yard can build.
        Returns:
        array of ship types that can be constructed.
      • calculateConstructionCosts

        int calculateConstructionCosts​(EShipType type)
        Calculate the labor costs for building a new ship of the indicated type.
        Parameters:
        type - of the ship
        Returns:
        costs.
      • calculateBuildTime

        int calculateBuildTime​(EShipType type)
        Calculate the build time for the ship of type.
        Parameters:
        type - ship type
        Returns:
        total build time for a ship of type type
      • calculateRepairTime

        int calculateRepairTime​(EShipType type)
        Calculate the repair time for the ship of type.
        Parameters:
        type - ship type
        Returns:
        total repair time for a ship of type type
      • removeCompletedRepair

        void removeCompletedRepair​(IShip ship)
        Remove the repair entry once it is completed.
        Parameters:
        ship - that is to be repaired.
      • removeCompletedConstruction

        void removeCompletedConstruction​(IShip ship)
        Remove the build entry once it is completed.
        Parameters:
        ship - that is to be built.
      • removeCompletedUpgrade

        void removeCompletedUpgrade​(IShip ship)
        Remove the upgrade entry once it is completed.
        Parameters:
        ship - that is to be upgraded.