Public Member Functions | |
void | addContract (Firm pEmployer, WorkContract pWorkContract) |
The method adds a contract to both the household's WorkContract list and employer list (with respective contracts). | |
void | removeContract (Firm pEmployer) |
The method removes a contract from both the household's WorkContract list and employer list (with respective contracts). | |
Iterator< WorkContract > | iterator () |
This iterator allows iteration over the work contracts of a household, sorted by the wage they would yield in a full time employment (from low to high). | |
Package Functions | |
double | calcCurrentWage () |
The current wage of the Household. | |
Private Member Functions | |
void | workContractsChanged () |
The method sets the workContractsChanged marker to TRUE, updates the list of households with changed work contract in the foundation, and recalculates the household's work amount. | |
double | calcWorkAmount () |
The sum of work amount over all work contracts of this Household. | |
Private Attributes | |
final LinkedHashMap< Firm, WorkContract > | firmWorkContractMap |
The wrapped map. | |
final List< WorkContract > | workContractSorted = new LinkedList<WorkContract>() |
The list of workContracts (the set is equal to firmWorkContractMap.values()). | |
double | totalWorkAmount = 0.d |
The sum of the work amount in all WorkContracts. |
E.g. this allows a delayed sorting (the list is not sorted when a new element is added, but before an iterator is used).
Definition at line 285 of file Household.java.
void addContract | ( | Firm | pEmployer, | |
WorkContract | pWorkContract | |||
) |
The method adds a contract to both the household's WorkContract list and employer list (with respective contracts).
If the firm and household already had a contract, the old contract is deleted before the new one is added.
Definition at line 357 of file Household.java.
Referenced by Household.addEmployment().
00357 { 00358 if (containsKey(pEmployer)) { 00359 workContractSorted.remove(firmWorkContractMap.get(pEmployer)); 00360 } 00361 firmWorkContractMap.put(pEmployer, pWorkContract); 00362 workContractSorted.add(pWorkContract); 00363 workContractsChanged(); 00364 }
void removeContract | ( | Firm | pEmployer | ) |
The method removes a contract from both the household's WorkContract list and employer list (with respective contracts).
Definition at line 368 of file Household.java.
Referenced by Household.removeEmployment().
00368 { 00369 workContractSorted.remove(firmWorkContractMap.get(pEmployer)); 00370 firmWorkContractMap.remove(pEmployer); 00371 workContractsChanged(); 00372 }
void workContractsChanged | ( | ) | [private] |
The method sets the workContractsChanged marker to TRUE, updates the list of households with changed work contract in the foundation, and recalculates the household's work amount.
Definition at line 381 of file Household.java.
Referenced by Household.Employers.addContract(), Household.Employers.iterator(), and Household.Employers.removeContract().
00381 { 00382 workContractsChanged = true; 00383 foundation.getHouseholds().workContractsChanged(Household.this); 00384 totalWorkAmount = calcWorkAmount(); 00385 }
double calcWorkAmount | ( | ) | [private] |
The sum of work amount over all work contracts of this Household.
Definition at line 397 of file Household.java.
Referenced by Household.Employers.workContractsChanged().
00397 { 00398 double lSumAmount = 0.d; 00399 00400 for (final WorkContract lWorkContract : workContractSorted) { 00401 lSumAmount += lWorkContract.getAmount(); 00402 } 00403 00404 return lSumAmount; 00405 }
double calcCurrentWage | ( | ) | [package] |
The current wage of the Household.
Only the wages from work contracts are accounted for (i.e. no unemployment assurance or dividends).
Definition at line 415 of file Household.java.
Referenced by Household.calcCurrentWage().
00415 { 00416 double lSumWage = 0.d; 00417 00418 for (final WorkContract lWorkContract : workContractSorted) { 00419 lSumWage += lWorkContract.getWageCurrentWorkAmount(); 00420 } 00421 00422 return lSumWage; 00423 }
Iterator<WorkContract> iterator | ( | ) |
This iterator allows iteration over the work contracts of a household, sorted by the wage they would yield in a full time employment (from low to high).
Definition at line 427 of file Household.java.
00427 { 00428 if (workContractsChanged) { 00429 Collections.sort(workContractSorted, new WorkContract.WageComparator()); 00430 workContractsChanged = false; 00431 } 00432 return workContractSorted.iterator(); 00433 }
final LinkedHashMap<Firm, WorkContract> firmWorkContractMap [private] |
Initial value:
new LinkedHashMap<Firm, WorkContract>()
Definition at line 292 of file Household.java.
Referenced by Household.Employers.addContract(), and Household.Employers.removeContract().
final List<WorkContract> workContractSorted = new LinkedList<WorkContract>() [private] |
The list of workContracts (the set is equal to firmWorkContractMap.values()).
Definition at line 327 of file Household.java.
Referenced by Household.Employers.addContract(), Household.Employers.calcCurrentWage(), Household.Employers.calcWorkAmount(), Household.Employers.iterator(), and Household.Employers.removeContract().
double totalWorkAmount = 0.d [private] |
The sum of the work amount in all WorkContracts.
Definition at line 335 of file Household.java.
Referenced by Household.Employers.workContractsChanged().