Class LoanerService
- java.lang.Object
-
- ch.sahits.game.openpatrician.clientserverinterface.service.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 Summary
Fields Modifier and Type Field Description private Date
date
private static RandomNameLoader
firstNameLoader
private static RandomNameLoader
lastNameLoader
private LoanerList
loaners
private java.util.Random
rnd
-
Constructor Summary
Constructors Constructor Description LoanerService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
calculatePaybacksum(IDebt debt)
Calculate the payback that is due on a debt.java.util.List<IDebt>
findDebts(ILoaner loaner, IPlayer player)
Find all the debt of a player with a given loaner.ILoaner
findLoaner(ICity city)
Find the loaner in the cityjava.util.List<IDebt>
findLoans(ILoaner loaner, IPlayer creditor)
Find all the debts that were granted by a player.void
takeOutLoan(ILoaner loaner, ILoanProposal proposal, IPlayer debitor, ICity city)
Take out a loan.
-
-
-
Field Detail
-
rnd
@Autowired private java.util.Random rnd
-
date
@Autowired private Date date
-
loaners
@Autowired private LoanerList loaners
-
firstNameLoader
private static RandomNameLoader firstNameLoader
-
lastNameLoader
private static RandomNameLoader lastNameLoader
-
-
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 loanproposal
- selected loandebitor
- 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 loancreditor
- 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 debtsplayer
- 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.
-
-