private Duration assignmentDuration ( Task task , Duration work ) { Duration result = work ; if ( result != null ) { if ( result . getUnits ( ) == TimeUnit . PERCENT ) { Duration taskWork = task . getWork ( ) ; if ( taskWork != null ) { result = Duration . getInstance ( taskWork . getDuration ( ) * result . getDuration ( ) , taskWork . getUnits ( ) ) ; } } } return result ; }
Extract a duration amount from the assignment converting a percentage into an actual duration .