Check if next call is allowed and increase the counts.

@return True if a next call is allowed.
426016
public boolean checkAndIncrease() {

        long newTimestamp = System.currentTimeMillis();

        if (isShutdown) {
            if (newTimestamp > shutdownEndTime) {
                isShutdown = false;
                largeLimitCalls = 0;
                smallLimitCalls = 0;
            } else {
                return false;
            }
        }

        if (newTimestamp - smallLimitTimestamp > smallTimeFrame) {
            smallLimitCalls = 0;
            smallLimitTimestamp = newTimestamp;
        } else {
            if (smallLimitCalls >= smallCallLimit) {
                return false;
            } else {
                smallLimitCalls += 1;
            }
        }

        if (newTimestamp - largeLimitTimestamp > largeTimeFrame) {
            largeLimitCalls = 0;
            largeLimitTimestamp = newTimestamp;
        } else {
            if (largeLimitCalls >= largeCallsLimit) {
                isShutdown = true;
                shutdownEndTime = newTimestamp + shutdownPeriod;
                return false;
            } else {
                largeLimitCalls += 1;
            }
        }

        return true;
    }
574671
public boolean isAnyPermissionPermanentlyDenied() {
    boolean hasPermanentlyDeniedAnyPermission = false;

    for (PermissionDeniedResponse deniedResponse : deniedPermissionResponses) {
      if (deniedResponse.isPermanentlyDenied()) {
        hasPermanentlyDeniedAnyPermission = true;
        break;
      }
    }

    return hasPermanentlyDeniedAnyPermission;
  }
1141689
def can_next(self, step, inputs, workflow, status):
        
        if not (step in status and status[step] in {'running', 'finalising'}):
            return False
        for out in step.outs:
            if not all(inputs[consumer].is_writable(out) for consumer in workflow.get_parents(out)):
                return False
        return True
878405
protected function proceedingAllowed(): bool
    {
        if ($this->input->getOption('no-interaction')) {
            return true;
        }

        return $this->getHelper('question')->ask($this->input, $this->output, new ConfirmationQuestion('<question>Are you sure you wish to flush the whole database? (y/n)</question>', false));
    }
363881
public boolean doHasPrevious()
    {
        if ((m_iRecordStatus & DBConstants.RECORD_AT_BOF) != 0)
            return false; // Already at BOF (can't be one before)
        if ((m_iRecordStatus & DBConstants.RECORD_PREVIOUS_PENDING) != 0)
            return true;    // Already one waiting
        boolean bAtBOF = true;
        try   {
            FieldList record = this.move(DBConstants.PREVIOUS_RECORD);
            if (record == null)
                bAtBOF = true;
            else if ((m_iRecordStatus & DBConstants.RECORD_AT_BOF) != 0)
                bAtBOF = true;
            else if (this.isTable())
                bAtBOF = this.isBOF();
            else
                bAtBOF = false;     // Valid record!
        } catch (DBException ex)    {
            ex.printStackTrace();
        }
        if (bAtBOF)
            return false; // Does not have a next record
        m_iRecordStatus |= DBConstants.RECORD_PREVIOUS_PENDING;     // If next call is a moveNext(), return unchanged!
        return true;        // Yes, a next record exists.
    }
973446
public boolean hasCheckMultiActions() {

        Iterator<CmsListMultiAction> it = m_multiActions.elementList().iterator();
        while (it.hasNext()) {
            CmsListMultiAction action = it.next();
            if (!(action instanceof CmsListRadioMultiAction)) {
                return true;
            }
        }
        return false;
    }
455794
private function canRetry()
    {
        if ($this->isUnlimitedAttempts()) {
            return true;
        }

        $this->attempts++;

        return $this->attempts < $this->maxAttempts;
    }
594456
public boolean hasMoreMessages() {
    if (!rqueue.isEmpty()) {
      return true;
    } else {
      synchronized (omap) {
        Iterator<TapStream> itr = omap.keySet().iterator();
        while (itr.hasNext()) {
          TapStream ts = itr.next();
          if (ts.isCompleted() || ts.isCancelled() || ts.hasErrored()) {
            omap.get(ts).shutdown();
            omap.remove(ts);
          }
        }
        if (omap.size() > 0) {
          return true;
        }
      }
    }
    return false;
  }
193676
private Call getNextCall(Integer nextLimit, String continueToken) {
    PagerParams params = new PagerParams((nextLimit != null) ? nextLimit : limit, continueToken);
    return listFunc.apply(params);
  }
426728
public boolean limit() {

        //get connection
        Object connection = getConnection();

        Object result = limitRequest(connection);

        if (FAIL_CODE != (Long) result) {
            return true;
        } else {
            return false;
        }
    }
135269
@Pure
	public boolean isEndingBusHalt() {
		final BusItinerary itinerary = getContainer();
		if (itinerary != null && itinerary.isValidPrimitive()) {
			final int count = itinerary.getValidBusHaltCount();
			if (count > 0) {
				try {
					return itinerary.getBusHaltAt(count - 1) == this;
				} catch (IndexOutOfBoundsException exception) {
					// invalid halt
				}
			}
		}
		return false;
	}
1152924
@Contract(pure = true)
	public boolean hasRemainingBytes(int remaining) {
		assert remaining >= 0;
		if (remaining == 0) return true;
		for (int i = first; i != last; i = next(i)) {
			int bufRemaining = bufs[i].readRemaining();
			if (bufRemaining >= remaining)
				return true;
			remaining -= bufRemaining;
		}
		return false;
	}
443642
public boolean next() {
    if (sketchAccessor_ == null) { // initial setup
      sketchAccessor_ = DoublesSketchAccessor.wrap(sketch_);
    } else { // advance index within the current level
      i_++;
    }
    if (i_ < sketchAccessor_.numItems()) {
      return true;
    }
    // go to the next non-empty level
    do {
      level_++;
      if (level_ > 0) {
        bits_ >>>= 1;
      }
      if (bits_ == 0L) {
        return false; // run out of levels
      }
      weight_ *= 2;
    } while ((bits_ & 1L) == 0L);
    i_ = 0;
    sketchAccessor_.setLevel(level_);
    return true;
  }
236454
@Override
    public boolean hasMoreElements() {
        // wind forward to the next non-empty enumeration
        while (index < enumerations.size() && !!!enumerations.get(index).hasMoreElements())
            index++;
        // return true iff there was a non-empty enumeration
        return index < enumerations.size();
    }
442281
public boolean waitForNewTimeslot() throws InterruptedException {
		
		boolean hasWaited = false;
		
		while(true) {
			final long numberOfEventsInTimeSlot = getNumberOfEventsInTimeslot();
			
			if(numberOfEventsInTimeSlot > numberOfEvents) {
				hasWaited = true;
				Thread.sleep(timeslotInMilliseconds / 10);
			} else {
				return hasWaited;
			}
		}
	}
150387
protected boolean isConnectionAllowed() {
        // Check internal handlers first
        for (ISharedObjectSecurity handler : securityHandlers) {
            if (!handler.isConnectionAllowed(this)) {
                return false;
            }
        }
        // Check global SO handlers next
        final Set<ISharedObjectSecurity> handlers = getSecurityHandlers();
        if (handlers == null) {
            return true;
        }
        for (ISharedObjectSecurity handler : handlers) {
            if (!handler.isConnectionAllowed(this)) {
                return false;
            }
        }
        return true;
    }
449456
public boolean makeCalls(long now) {
    if (now < nextDispatchTime)
      return true;

    // we make calls in a loop until all pending calls are drained
    // if any call hits an error - we stop
    while (!pendingCalls.isEmpty()) {

      TBase call = pendingCalls.get(0);
      try {
        // initialize the client/transport unless already done
        init();

        // make one thrift call
        dispatchCall(call);

        // if we made a call successfully, reset any retry state
        nextDispatchTime = -1;
        numRetries = 0;
        currentRetryInterval = retryIntervalStart;

        pendingCalls.remove(0);

      } catch (TException e) {
        boolean logged = false;
        if (e instanceof TTransportException) {
          TTransportException tte = (TTransportException) e;
          Throwable cause =  tte.getCause();
          if (cause != null && cause instanceof SocketTimeoutException) {
            // Got a socket timeout while waiting for a response from the
            // client. The session is stuck.
            logged = true;
            LOG.error("Call to session: " + handle + " for call: " +
              call.getClass().getName() + ", numRetry: " + numRetries +
              "(retryCountMax=" + retryCountMax + ")" +
              " failed with SocketTimeoutException, will retry it");
          }
        }
        if (!logged) {
          LOG.warn("Call to session: " + handle + " for call: " +
            call.getClass().getName() + ", numRetry: " + numRetries +
            "(retryCountMax=" + retryCountMax + ")" +
            " failed with TException", e);
        }

        // close the transport/client on any exception
        // will be reopened on next try
        close();

        if (numRetries > retryCountMax)
          return false;

        numRetries++;
        nextDispatchTime = now + currentRetryInterval;
        currentRetryInterval *= retryIntervalFactor;

        // no more calls for now
        return true;
      }
    }

    close();

    return true;
  }