Bug 207

Summary: Incorrect loop handler when Courier is checking out Orders from Branch office
Product: Group 1 Reporter: lpzjerry
Component: BranchAssignee: WANG Ruochen <ruochwang2-c>
Status: RESOLVED FIXED    
Severity: normal CC: ruochwang2-c, sherlockqiu
Priority: ---    
Version: v0.1-alpha   
Hardware: Macintosh   
OS: Mac OS   
Bug Depends on: 454    
Bug Blocks:    
Attachments: Branch source code

Description lpzjerry 2017-11-25 20:42:41 HKT
Created attachment 1 [details]
Branch source code

Bug reproduce:
1. Instantiate a Branch office
2. Add Orders (as test stub) to the Order Queue
3. Assign the Orders to the Courier

Expected Output:
The orders are assigned if the Queue is empty

Program Rundown:
The list is empty while the loop did not exit

In Branch.java, line 97:
    while (weight < courier.getCapacity() && thingsToSend.size() > 0) {
                                             ^
thingsToSend refers the ArrayList which will be assigned to the Courier, rather than the list of the undelivered Order Queue.