public Rate getRate ( int field ) throws MPXJException { Rate result ; if ( ( field < m_fields . length ) && ( m_fields [ field ] . length ( ) != 0 ) ) { try { String rate = m_fields [ field ] ; int index = rate . indexOf ( ' ' ) ; double amount ; TimeUnit units ; if ( index == - 1 ) { amount = m_formats . getCurrencyFormat ( ) . parse ( rate ) . doubleValue ( ) ; units = TimeUnit . HOURS ; } else { amount = m_formats . getCurrencyFormat ( ) . parse ( rate . substring ( 0 , index ) ) . doubleValue ( ) ; units = TimeUnitUtility . getInstance ( rate . substring ( index + 1 ) , m_locale ) ; } result = new Rate ( amount , units ) ; } catch ( ParseException ex ) { throw new MPXJException ( "Failed to parse rate" , ex ) ; } } else { result = null ; } return ( result ) ; }
Accessor method used to retrieve an Rate object representing the contents of an individual field . If the field does not exist in the record null is returned .