Returns a boolean indicating if the host is within the current state limit.
198925
def is_host_in_limit(self, host):
        '''
        
        '''

        limit_hosts = self.limit_hosts

        if not isinstance(limit_hosts, list):
            return True
        return host in limit_hosts
612096
def state(self):
        
        if self.method in ['OPTIONS', 'DESCRIBE', 'SETUP', 'PLAY']:
            state = STATE_STARTING
        elif self.method in ['KEEP-ALIVE']:
            state = STATE_PLAYING
        else:
            state = STATE_STOPPED
        _LOGGER.debug('RTSP session (%s) state %s', self.host, state)
        return state
723030
def _find_limit_hosted_zone(self):
        
        for limit_type in [self.MAX_RRSETS_BY_ZONE,
                           self.MAX_VPCS_ASSOCIATED_BY_ZONE]:
            self.limits[limit_type["name"]]._reset_usage()

        for hosted_zone in self._get_hosted_zones():
            for limit_type in [self.MAX_RRSETS_BY_ZONE,
                               self.MAX_VPCS_ASSOCIATED_BY_ZONE]:

                if limit_type == self.MAX_VPCS_ASSOCIATED_BY_ZONE and \
                        not hosted_zone["Config"]["PrivateZone"]:
                    continue

                limit = self._get_hosted_zone_limit(limit_type["type"],
                                                    hosted_zone['Id'])

                self.limits[limit_type["name"]]._add_current_usage(
                    int(limit["Count"]),
                    maximum=int(limit["Limit"]["Value"]),
                    aws_type='AWS::Route53::HostedZone',
                    resource_id=hosted_zone["Name"]
                )
885553
public static boolean isEndState(TraceEvent te)
   {
      if (te.getType() == TraceEvent.RETURN_CONNECTION_LISTENER ||
          te.getType() == TraceEvent.RETURN_CONNECTION_LISTENER_WITH_KILL ||
          te.getType() == TraceEvent.RETURN_INTERLEAVING_CONNECTION_LISTENER ||
          te.getType() == TraceEvent.RETURN_INTERLEAVING_CONNECTION_LISTENER_WITH_KILL ||
          te.getType() == TraceEvent.CLEAR_CONNECTION_LISTENER)
         return true;

      return false;
   }
239021
def triggered(self):
        
        if self.stop is not None and not self.stop_reached:
            return False

        if self.limit is not None and not self.limit_reached:
            return False

        return True
1039892
protected synchronized boolean isAvailable(long now) {
		if (max == 0 || min == 0) {
			return true;
		}
		if (now - max > lockTimeout) {
			if (now - tested > lockTimeout) {
				tested = now;
				return true;
			}
			return false;
		}
		if (locked) {
			return false;
		}
		if (now - min > windowLength) {
			return true;
		}
		locked = true;
		return false;
	}
1169611
def host_in_set (ip, hosts, nets):
    
    if ip in hosts:
        return True
    if is_valid_ipv4(ip):
        n = dq2num(ip)
        for net in nets:
            if dq_in_net(n, net):
                return True
    return False
136751
def is_full(self):
        """"""
        capacity = self.get_true_capacity()
        if capacity != -1:
            num_signed_up = self.eighthsignup_set.count()
            return num_signed_up >= capacity
        return False
1142982
def get_state(self, hosts, services):
        
        # If we are a host or a service, we just got the host/service
        # hard state
        if self.operand == 'host':
            host = hosts[self.sons[0]]
            return self.get_host_node_state(host.last_hard_state_id,
                                            host.problem_has_been_acknowledged,
                                            host.in_scheduled_downtime)
        if self.operand == 'service':
            service = services[self.sons[0]]
            return self.get_service_node_state(service.last_hard_state_id,
                                               service.problem_has_been_acknowledged,
                                               service.in_scheduled_downtime)
        if self.operand == '|':
            return self.get_complex_or_node_state(hosts, services)

        if self.operand == '&':
            return self.get_complex_and_node_state(hosts, services)

        #  It's an Xof rule
        if self.operand == 'of:':
            return self.get_complex_xof_node_state(hosts, services)

        # We have an unknown node. Code is not reachable because we validate operands
        return 4
925860
public boolean canOpen()
  {
    if (getIdleCount() > 0) {
      return true;
    }
    
    State state = _state;

    if (state == State.ACTIVE)
      return true;
    else if (! state.isEnabled())
      return false;
    else {
      long now = CurrentTime.currentTime();

      if (isFailed(now)) {
        return false;
      }

      return true;
    }
  }
700011
boolean isKeepaliveAllowed(long connectionStartTime)
  {
    if (! _lifecycle.isActive()) {
      return false;
    }
    else if (connectionStartTime + _keepaliveTimeMax < CurrentTime.currentTime()) {
      return false;
    }
    else if (_keepaliveMax <= _keepaliveAllocateCount.get()) {
      return false;
    }
    /*
    else if (_connThreadPool.isThreadMax()
             && _connThreadPool.isIdleLow()
             && ! isKeepaliveAsyncEnabled()) {
      return false;
    }
    */
    else {
      return true;
    }
  }
344568
def _narrow_states(node, old_state, new_state, previously_widened_state):  # pylint:disable=unused-argument,no-self-use
        

        l.debug('Narrowing state at IP %s', previously_widened_state.ip)

        s = previously_widened_state.copy()

        narrowing_occurred = False

        # TODO: Finish the narrowing logic

        return s, narrowing_occurred
838672
def count(self) -> int:
        ''''''
        counter = 0

        for pool in self._host_pools.values():
            counter += pool.count()

        return counter
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;
    }
715443
public boolean isLocalHostname(String host) {
		checkState();
		try {
			InetAddress[] addresses = InetAddress.getAllByName(host);

			Set<InetAddress> stackAddresses = new HashSet<InetAddress>();

			for (ListeningPoint lp : this.provider.getListeningPoints()) {
				InetAddress tmp = InetAddress.getByName(lp.getIPAddress());
				if (tmp != null)
					stackAddresses.add(tmp);
			}

			for (InetAddress ia : addresses) {
				if (stackAddresses.contains(ia))
					return true;
			}

		} catch (UnknownHostException e) {
			if (tracer.isFineEnabled()) {
				tracer.fine("Unknown host",e);
			}
		}

		return false;
	}
73165
protected boolean maxRequestsServed() {
        // PK12235, check for a partial or full stop
        if (getChannel().isStopping()) {
            // channel has stopped, no more keep-alives
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Channel stopped, disabling keep-alive request");
            }
            return true;
        }
        if (!getChannel().getHttpConfig().isKeepAliveEnabled()) {
            // keep alives are disabled, no need to check the max request number
            return true;
        }
        int max = getChannel().getHttpConfig().getMaximumPersistentRequests();
        // -1 is unlimited, 0..1 is 1 request, any above that is that exact
        // number of requests
        if (0 <= max) {
            return (this.numRequestsProcessed >= max);
        }
        return false;
    }
1353645
def _get_hosted_zone_limit(self, limit_type, hosted_zone_id):
        

        result = self.conn.get_hosted_zone_limit(
            Type=limit_type,
            HostedZoneId=hosted_zone_id
        )

        return result