public float getHourlyRate(DateTime effectiveDate) { CompensationDetail cd = getCompensationDetail(effectiveDate); LaborCostMultiplier lcm = getMultiplier(effectiveDate); float rawCostRate = (cd == null) ? 0 : cd.getHourlyCostRate(); float multiplier = (lcm == null) ? 1 : lcm.getMultiplier(); return rawCostRate * multiplier; }
LaborCostMultiplier getMultiplier(DateTime effectiveDate) { Iterator<LaborCostMultiplier> iter = laborCostMultipliers.iterator(); while (iter.hasNext()) { LaborCostMultiplier each = iter.next(); if (each.isEffective(effectiveDate)) { return each; } } return null; }
@Override public int compare(LaborCostMultiplier o1, LaborCostMultiplier o2) { DateTime d1 = o1.getStartDate(); DateTime d2 = o2.getStartDate(); return d1.isBefore(d2) ? -1 : (d1.isEqual(d2) ? 0 : 1); }