private Integer getSumOwed() { Integer sumOwed = 0; for (Balance creditor : self.creditors()) { sumOwed += creditor.getBalance() < 0 ? -creditor.getBalance() : 0; } return sumOwed; }
public boolean canFindUnpaidCreditor() { // Dynamic Role binding (happens *during* enactment) Creditor = null; for (Balance creditorCandidate : Bank.getCreditors()) { if (creditorCandidate.getBalance() < 0) { Creditor = creditorCandidate; break; } } return Creditor != null; }