示例#1
0
      private Integer getSumOwed() {
        Integer sumOwed = 0;
        for (Balance creditor : self.creditors()) {
          sumOwed += creditor.getBalance() < 0 ? -creditor.getBalance() : 0;
        }

        return sumOwed;
      }
示例#2
0
 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;
 }