public void setRate ( float hertz ) { // Check that the argument is above zero. if ( hertz <= 0.0f ) { throw new IllegalArgumentException ( "The throttle rate must be above zero." ) ; } // Calculate the cycle time. cycleTimeNanos = ( long ) ( 1000000000f / hertz ) ; // Reset the first pass flag. firstCall = false ; firstCheckCall = false ; }
Specifies the throttling rate in operations per second . This must be called with with a value the inverse of which is a measurement in nano seconds such that the number of nano seconds do not overflow a long integer . The value must also be larger than zero .