public boolean shouldExecuteAction(){
  if (delay <= 0) {
    return true;
  }
  long timePassed=System.currentTimeMillis() - lastActionExecuted;
  if (timePassed > delay * 100) {
    lastActionExecuted=System.currentTimeMillis();
    return true;
  }
  return false;
}

public boolean shouldExecuteAction ( ) { if ( delay <= 0 ) { return true ; } long timePassed = System . currentTimeMillis ( ) - lastActionExecuted ; if ( timePassed > delay * 100 ) { lastActionExecuted = System . currentTimeMillis ( ) ; return true ; } return false ; }
checks whether an action should currently be executed , based on the required delay . also assumes that an action was executed if this returns true and sets the time of the last action to the current time .
