public void process ( AvailabilityTable table , byte [ ] data ) { if ( data != null ) { Calendar cal = DateHelper . popCalendar ( ) ; int items = MPPUtility . getShort ( data , 0 ) ; int offset = 12 ; for ( int loop = 0 ; loop < items ; loop ++ ) { double unitsValue = MPPUtility . getDouble ( data , offset + 4 ) ; if ( unitsValue != 0 ) { Date startDate = MPPUtility . getTimestampFromTenths ( data , offset ) ; Date endDate = MPPUtility . getTimestampFromTenths ( data , offset + 20 ) ; cal . setTime ( endDate ) ; cal . add ( Calendar . MINUTE , - 1 ) ; endDate = cal . getTime ( ) ; Double units = NumberHelper . getDouble ( unitsValue / 100 ) ; Availability item = new Availability ( startDate , endDate , units ) ; table . add ( item ) ; } offset += 20 ; } DateHelper . pushCalendar ( cal ) ; Collections . sort ( table ) ; } }
Populates a resource availability table .