Class LoanerService


  • public class LoanerService
    extends java.lang.Object
    Providing services of a loaner that are used in the engine and the UI.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2016 Created on Jun 12, 2016
    • Field Detail

      • rnd

        @Autowired
        private java.util.Random rnd
      • date

        @Autowired
        private Date date
    • Constructor Detail

      • LoanerService

        public LoanerService()
    • Method Detail

      • takeOutLoan

        public void takeOutLoan​(ILoaner loaner,
                                ILoanProposal proposal,
                                IPlayer debitor,
                                ICity city)
        Take out a loan.
        Parameters:
        loaner - from which to take the loan
        proposal - selected loan
        debitor - who is taking the loan.
      • findLoaner

        public ILoaner findLoaner​(ICity city)
        Find the loaner in the city
        Parameters:
        city - in which the loaner should be looked up.
        Returns:
        matching loaner.
      • findLoans

        public java.util.List<IDebt> findLoans​(ILoaner loaner,
                                               IPlayer creditor)
        Find all the debts that were granted by a player.
        Parameters:
        loaner - which is searched for the loan
        creditor - of the loan
        Returns:
        list of debts
      • findDebts

        public java.util.List<IDebt> findDebts​(ILoaner loaner,
                                               IPlayer player)
        Find all the debt of a player with a given loaner.
        Parameters:
        loaner - to check the player's debts
        player - to check the debts for
        Returns:
        List of debts.
      • calculatePaybacksum

        public int calculatePaybacksum​(IDebt debt)
        Calculate the payback that is due on a debt.
        Parameters:
        debt - for which the payback sum is to be calculated
        Returns:
        payback sum per current date.