Verify if the namespace count disk space satisfies the quota restriction
@throws QuotaExceededException if the given quota is less than the count
764802
void verifyQuota(long nsDelta, long dsDelta) throws QuotaExceededException {
    long newCount = nsCount + nsDelta;
    long newDiskspace = diskspace + dsDelta;
    if (nsDelta>0 || dsDelta>0) {
      if (nsQuota >= 0 && nsQuota < newCount) {
        throw new NSQuotaExceededException(nsQuota, newCount);
      }
      if (dsQuota >= 0 && dsQuota < newDiskspace) {
        throw new DSQuotaExceededException(dsQuota, newDiskspace);
    }
    }
  }
756267
public Parameters copyNamespaceIfPresent(final String requestedNamespace) {
    // checkArgument ensures namespaces are specified consistently
    checkArgument(!requestedNamespace.isEmpty());
    checkArgument(!requestedNamespace.endsWith(DELIM));
    if (isNamespacePresent(requestedNamespace)) {
      return copyNamespace(requestedNamespace);
    } else {
      return copy();
    }
  }
1008019
@Nonnegative
  public static int getLeadingWhitespaceCount (@Nullable final String s)
  {
    int ret = 0;
    if (s != null)
    {
      final int nMax = s.length ();
      while (ret < nMax && Character.isWhitespace (s.charAt (ret)))
        ++ret;
    }
    return ret;
  }
666107
public boolean keyspaceExists(DBConn dbConn, String keyspace) {
        try {
            dbConn.getClientSession().describe_keyspace(keyspace);
            return true;
        } catch (Exception e) {
            return false;   // Notfound
        }
    }
550625
protected void countSpaces(String host,
                               DuplicationInfo info,
                               ContentStore store,
                               List<String> spaces,
                               boolean primary) {
        String storeId = store.getStoreId();
        String storeType = store.getStorageProviderType();
        for (String spaceId : spaces) {
            boolean doCount = false;
            // Handle spaces which include space ID, formatted like: spaceId:storeId
            if (spaceId.indexOf(":") > -1) {
                String[] spaceAndStoreId = spaceId.split(":");
                spaceId = spaceAndStoreId[0];
                if (primary || storeId.equals(spaceAndStoreId[1])) {
                    doCount = true;
                }
            } else {
                doCount = true;
            }

            if (doCount) {
                countSpace(host, spaceId, storeId, storeType, info, store);
            }
        }
    }
1360776
public function shouldEnableLegacyNamespace()
    {
        if (isset($this->pkgAutoloaderMapCoreExtensions) && $this->pkgAutoloaderMapCoreExtensions) {
            // We're no longer using this to denote non-legacy applications, but if a package uses this
            // that means it's NOT using the legacy namespace.
            return false;
        }

        $concrete5 = '7.9.9';
        $package = $this->getApplicationVersionRequired();
        if (version_compare($package, $concrete5, '>')) {
            return false;
        }

        return $this->pkgEnableLegacyNamespace;
    }
734595
public boolean isWhiteSpace() {
		switch (getEventType()) {
		case XMLStreamConstants.CHARACTERS:
			return this.characters.toString().trim().length() == 0;
		case XMLStreamConstants.CDATA:
			return false;
		case XMLStreamConstants.COMMENT:
			return false;
		case XMLStreamConstants.SPACE:
			return true;
		default:
			return false;
		}
	}
1323471
private void checkQuotas(long timeMs, boolean preCheck, double requestedValue) {
        for (int i = 0; i < this.metrics.size(); i++) {
            TehutiMetric metric = this.metrics.get(i);
            MetricConfig config = metric.config();
            if (config != null) {
                Quota quota = config.quota();
                if (quota != null) {
                    // Only check the quota on the right time. If quota is set to check quota before recording,
                    // only verify the usage in pre-check round.
                    if (quota.isCheckQuotaBeforeRecording() ^ preCheck) {
                        continue;
                    }
                    // If we check quota before recording, we should count on the value of the current request.
                    // So we could prevent the usage of current request exceeding the quota.
                    double value = preCheck? metric.extraValue(timeMs, requestedValue): metric.value(timeMs);
                    if (!quota.acceptable(value)) {
                        throw new QuotaViolationException(
                            "Metric " + metric.name() + " is in violation of its " + quota.toString(), value);
                    }
                }
            }
        }
    }
215144
@Override
    public boolean isWhiteSpace()
    {
        final int currToken = mCurrToken;
        if (currToken == CHARACTERS || currToken == CDATA) {
            if (mTokenState < mStTextThreshold) {
                safeFinishToken();
            }
            if (mWsStatus == ALL_WS_UNKNOWN) {
                mWsStatus = mTextBuffer.isAllWhitespace() ?
                    ALL_WS_YES : ALL_WS_NO;
            }
            return mWsStatus == ALL_WS_YES;
        }
        return (currToken == SPACE);
    }
723207
public static boolean isFileSizeUnderLimit(ByteSizeValue limit, long fileSizeAsBytes) {
        boolean result = true;
        if (limit != null) {
            // We check the file size to avoid indexing too big files
            ByteSizeValue fileSize = new ByteSizeValue(fileSizeAsBytes);
            int compare = fileSize.compareTo(limit);
            result = compare <= 0;
            logger.debug("Comparing file size [{}] with current limit [{}] -> {}", fileSize, limit,
                    result ? "under limit" : "above limit");
        }

        return result;
    }
242364
public boolean isWhitespace(int start, int length)
  {

    int sourcechunk = start >>> m_chunkBits;
    int sourcecolumn = start & m_chunkMask;
    int available = m_chunkSize - sourcecolumn;
    boolean chunkOK;

    while (length > 0)
    {
      int runlength = (length <= available) ? length : available;

      if (sourcechunk == 0 && m_innerFSB != null)
        chunkOK = m_innerFSB.isWhitespace(sourcecolumn, runlength);
      else
        chunkOK = org.apache.xml.utils.XMLCharacterRecognizer.isWhiteSpace(
          m_array[sourcechunk], sourcecolumn, runlength);

      if (!chunkOK)
        return false;

      length -= runlength;

      ++sourcechunk;

      sourcecolumn = 0;
      available = m_chunkSize;
    }

    return true;
  }
125020
public boolean isNamespacePresent(final String requestedNamespace) {
    checkArgument(requestedNamespace.length() > 0);
    checkArgument(!requestedNamespace.endsWith(DELIM));
    final String probe = requestedNamespace + DELIM;
    return Iterables.any(params.keySet(), StringUtils.startsWith(probe));
  }
13868
public void ensureHasSpace(int numBytesToAdd) {
    if (numBytesToAdd < 0) {
      throw new IllegalArgumentException("Number of bytes can't be negative");
    }
    int capacityLeft = getCapacityLeft();
    if (capacityLeft < numBytesToAdd) {
      grow(numBytesToAdd - capacityLeft, true);
    }
  }
1178851
@Override
    public boolean hasRemaining() {
        if (isFCEnabled()) {
            int remaining = this.fcLimit - position();
            if (remaining < 0) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "hasRmeaining, less than 0");
                }
                RuntimeException rte = new RuntimeException("FCWsByteBufferImpl.hasRemaining(): value is less than 0");
                FFDCFilter.processException(rte, CLASS_NAME + ".hasRemaining()", "1115", this);
                throw rte;
            }
            return (remaining > 0);
        }
        return super.hasRemaining();
    }
36158
private boolean incSlotLimit(JobInfo info, TaskType type, LimitType limit) {
    switch (limit) {
      case MIN:
        if (type == TaskType.MAP) {
          if (info.minMaps < runnableTasks(info, type)) {
            info.minMaps += 1;
            return true;
          }
        } else {
          if (info.minReduces < runnableTasks(info, type)) {
            info.minReduces += 1;
            return true;
          }
        }
        return false;
      case MAX:
        if (type == TaskType.MAP) {
          if (info.maxMaps < runnableTasks(info, type)) {
            info.maxMaps += 1;
            return true;
          }
        } else {
          if (info.maxReduces < runnableTasks(info, type)) {
            info.maxReduces += 1;
            return true;
          }
        }
        return false;
    }
    // Never come here
    return false;
  }
702548
private List<Metric> checkTablespace(final Connection c, final ICommandLine cl) throws BadThresholdException, SQLException {

        // Metric : tblspace_usage

        List<Metric> metricList = new ArrayList<Metric>();

        String sTablespace = cl.getOptionValue("tablespace").toUpperCase();

        // FIXME : a prepared satement should be used
        final String sQry = String.format(QRY_CHECK_TBLSPACE_PATTERN, sTablespace);
        Statement stmt = null;
        ResultSet rs = null;

        try {
            stmt = c.createStatement();

            rs = stmt.executeQuery(sQry);

            boolean bFound = rs.next();

            if (!bFound) {
                throw new SQLException("Tablespace " + cl.getOptionValue("tablespace") + " not found.");
            }

            BigDecimal tsFree = rs.getBigDecimal(1);
            BigDecimal tsTotal = rs.getBigDecimal(2);
            BigDecimal tsPct = rs.getBigDecimal(3);
            //
            metricList.add(new Metric("tblspace_freepct", cl.getOptionValue("tablespace") + " : " + tsPct + "% free", tsPct, new BigDecimal(0),
                    new BigDecimal(100)));

            metricList.add(new Metric("tblspace_free", cl.getOptionValue("tablespace") + " : " + tsFree + "MB free", tsPct, new BigDecimal(0),
                    tsTotal));

            return metricList;

        } finally {
            DBUtils.closeQuietly(rs);
            DBUtils.closeQuietly(stmt);
        }

    }
143352
public boolean compete(NamespaceSpecification other) {
    // if no wildcard for other then we check coverage
    if ("".equals(other.wildcard)) {
      return covers(other.ns);
    }
    // split the namespaces at wildcards     
    String[] otherParts = split(other.ns, other.wildcard);
    
    // if the given namepsace specification does not use its wildcard
    // then we just look if the current namespace specification covers it
    if (otherParts.length == 1) {
      return covers(other.ns);
    }
    // if no wildcard for the current namespace specification
    if ("".equals(wildcard)) {
      return other.covers(ns);
    }
    // also for the current namespace specification
    String[] parts = split(ns, wildcard); 
    // now check if the current namespace specification is just an URI
    if (parts.length == 1) {
      return other.covers(ns);
    }
    // now each namespace specification contains wildcards
    // suppose we have 
    // ns   = a1*a2*...*an 
    // and 
    // other.ns = b1*b2*...*bm
    // then we only need to check matchPrefix(a1, b1) and matchPrefix(an, bn) where
    // matchPrefix(a, b) means a starts with b or b starts with a.
    return matchPrefix(parts[0], otherParts[0])
           && matchPrefix(parts[parts.length - 1], otherParts[otherParts.length - 1]);
  }