Matches code in MediaProvider.computeBucketValues. Should be a common
function.
760308
public String getBucketId(String path) {
        return String.valueOf(path.toLowerCase(Locale.US).hashCode());
    }
652234
@SuppressWarnings("rawtypes")
    static String validateProductMatches(String feature, List productMatchers, File installDir, boolean installingAsset) {
        return validateProductMatches(feature, null, productMatchers, installDir, installingAsset);
    }
1146059
function compareContents(fs, checksumList, callback) {
  var ECHKSUM = "Checksums do not match";

  var paramError = validateParams(fs, checksumList);
  if(paramError) {
    return callback(paramError);
  }

  function compare(checksumNode, callback) {
    var path = checksumNode.path;

    fs.lstat(path, function(err, stat) {
      if(err && err.code !== 'ENOENT') {
        return callback(err);
      }

      // If the types of the nodes on each fs do not match
      // i.e. /a is a file on fs1 and /a is a directory on fs2
      if(!err && checksumNode.type !== stat.type) {
        return callback(ECHKSUM);
      }

      // If the node type is a directory, checksum should not exist
      if(!err && stat.isDirectory()) {
        if(!checksumNode.checksum) {
          return callback();
        }

        callback(ECHKSUM);
      }

      // Checksum comparison for a non-existent path or file/link
      getChecksum(fs, path, function(err, checksum) {
        if(err) {
          return callback(err);
        }

        if(checksum !== checksumNode.checksum) {
          return callback(ECHKSUM);
        }

        callback();
      });
    });
  }

  async.eachSeries(checksumList, compare, function(err) {
    if(err && err !== ECHKSUM) {
      return callback(err);
    }

    callback(null, err !== ECHKSUM);
  });
}
283796
def match(tgt, functions=None, opts=None):
    '''
    
    '''
    if not opts:
        opts = __opts__
    if functions is None:
        utils = salt.loader.utils(opts)
        functions = salt.loader.minion_mods(opts, utils=utils)
    comps = tgt.split(':')
    if len(comps) < 2:
        return False
    val = functions['data.getval'](comps[0])
    if val is None:
        # The value is not defined
        return False
    if isinstance(val, list):
        # We are matching a single component to a single list member
        for member in val:
            if fnmatch.fnmatch(six.text_type(member).lower(), comps[1].lower()):
                return True
        return False
    if isinstance(val, dict):
        if comps[1] in val:
            return True
        return False
    return bool(fnmatch.fnmatch(
        val,
        comps[1],
    ))
307520
private Object syncGetValueFromBucket(FastSyncHashBucket hb, int key, boolean remove) {
        FastSyncHashEntry e = null;
        FastSyncHashEntry last = null;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "syncGetValueFromBucket: key, remove " + key + " " + remove);
        }
        synchronized (hb) {
            e = hb.root;
            while (e != null) {
                if (e.key == key) {
                    if (remove) {
                        if (last == null) {
                            // this is root
                            hb.root = e.next;
                        } else {
                            last.next = e.next;
                        }
                    }
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                        Tr.exit(tc, "syncGetValueFromBucket: found value in bucket");
                    }
                    return e.value;
                }
                last = e;
                e = e.next;
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "syncGetValueFromBucket-returned null");
        }
        return null;
    }
1276367
private boolean isRenditionMatchSizeSameBigger(MediaFormat mediaFormat, MediaFormat mediaFormatRequested) {
    long widthRequested = mediaFormatRequested.getEffectiveMinWidth();
    long heightRequested = mediaFormatRequested.getEffectiveMinHeight();

    long widthMax = mediaFormat.getEffectiveMaxWidth();
    long heightMax = mediaFormat.getEffectiveMaxHeight();

    return ((widthMax >= widthRequested) || (widthMax == 0))
        && ((heightMax >= heightRequested) || (heightMax == 0));
  }
1213347
private boolean doesPublicanCfgsContainValue(final ContentSpec contentSpec, final String value) {
        final Pattern pattern = Pattern.compile("^(.*\\n)?( |\\t)*" + value + ":.*", java.util.regex.Pattern.DOTALL);
        if (!isNullOrEmpty(contentSpec.getPublicanCfg()) && pattern.matcher(contentSpec.getPublicanCfg()).matches()) {
            return true;
        } else if (!contentSpec.getAllAdditionalPublicanCfgs().isEmpty()) {
            for (final Entry<String, String> entry : contentSpec.getAllAdditionalPublicanCfgs().entrySet()) {
                if (!isNullOrEmpty(entry.getValue()) && pattern.matcher(entry.getValue()).matches()) {
                    return true;
                }
            }
        }

        return false;
    }
1357852
public <T> void setRiakBucketType(T obj, BinaryValue bucketType)
    {
        if (riakBucketTypeSetter != null)
        {
            if (riakBucketTypeSetter.getParameterTypes()[0].isArray())
            {
                setMethodValue(riakBucketTypeSetter, obj, bucketType.unsafeGetValue());
            }
            else
            {
                setMethodValue(riakBucketTypeSetter, obj, bucketType.toString());
            }
        }
        else if (riakBucketTypeField != null)
        {
            if (riakBucketTypeField.getType().equals(String.class))
            {
                setFieldValue(riakBucketTypeField, obj, bucketType.toString());
            }
            else
            {
                setFieldValue(riakBucketTypeField, obj, bucketType.unsafeGetValue());
            }
        }
    }
675868
function parseBucketConfig(obj) {
    function parseFunctor(f) {
        var fn;
        /* jsl:ignore */
        eval('fn = ' + f);
        /* jsl:end */
        return (fn);
    }
    var res = {
        name: obj.name,
        index: JSON.parse(obj.index),
        pre: JSON.parse(obj.pre).map(parseFunctor),
        post: JSON.parse(obj.post).map(parseFunctor),
        options: JSON.parse(obj.options),
        mtime: new Date(obj.mtime)
    };
    if (obj.reindex_active) {
        res.reindex_active = JSON.parse(obj.reindex_active);
    }
    return (res);
}
1374300
private boolean validateBucket(String left, String right, String operator)
    {
        Double leftValue = Double.valueOf(left);
        Double rightValue = Double.valueOf(right);

        logger.debug("Comparison expression " + operator + "found with left value: " + left + " right value: " + right);

        if (Expression.GREATER_THAN.equals(operator))
        {
            return leftValue > rightValue;
        }
        else if (Expression.GREATER_THAN_OR_EQUAL.equals(operator))
        {
            return leftValue >= rightValue;
        }
        else if (Expression.LOWER_THAN.equals(operator))
        {
            return leftValue < rightValue;
        }
        else if (Expression.LOWER_THAN_OR_EQUAL.equals(operator))
        {
            return leftValue <= rightValue;
        }
        else if (Expression.EQUAL.equals(operator))
        {
            return leftValue == rightValue;
        }
        else
        {
            logger.error(operator + " in having clause is not supported in Kundera");
            throw new UnsupportedOperationException(operator + " in having clause is not supported in Kundera");
        }
    }
952078
private boolean matchMetadata(MetaData metadata)
    {
        boolean match;

        if (this.metadataValue != null) {
            Object value = metadata.getMetaData(this.metadataKey);
            match = value != null && value.equals(this.metadataValue);
        } else {
            match = metadata.contains(this.metadataKey);
        }

        return match;
    }
293466
function compatibilityValuesRamp (datasource, column, args) {
  var values = args[0];
  var method = (args[1] || 'quantiles').toLowerCase();
  var numBuckets = values.getLength();
  return getRamp(datasource, column, numBuckets, method).then(compatibilityCreateRampFn(values));
}
88889
private HashCalculationResult hashBuckets(byte[] fileWithoutSpaces, double bucketSize) throws IOException {
        // int(bucket_size) will round down the bucket_size: IE: 1.2 -> 1.0
        int bucketIntSize = (int) bucketSize;

        // Get bytes and calculate sha1
        byte[] mostSigBytes = Arrays.copyOfRange(fileWithoutSpaces, 0, bucketIntSize);
        int length = fileWithoutSpaces.length;
        byte[] leastSigBytes = Arrays.copyOfRange(fileWithoutSpaces, length - bucketIntSize, length);
        String fullFileHash = calculateByteArraySHA1(fileWithoutSpaces);
        String mostSigBitsHash = calculateByteArraySHA1(mostSigBytes);
        String leastSigBitsHash = calculateByteArraySHA1(leastSigBytes);
        return new HashCalculationResult(fullFileHash, mostSigBitsHash, leastSigBitsHash);
    }
869101
def compute_checksum(self):
        
        if self._filename.startswith("s3://"):
            print("Warning: Did not perform client-side checksumming for file in S3. To be implemented.")
            pass
        else:
            checksumCalculator = self.ChecksumCalculator(self._filename)
            self._checksums = checksumCalculator.compute()
330392
def _compute_bgid(self, bg=None):
        """"""
        if bg is None:
            bg = self._bgdata
        if isinstance(bg, qpimage.QPImage):
            # Single QPImage
            if "identifier" in bg:
                return bg["identifier"]
            else:
                data = [bg.amp, bg.pha]
                for key in sorted(list(bg.meta.keys())):
                    val = bg.meta[key]
                    data.append("{}={}".format(key, val))
                return hash_obj(data)
        elif (isinstance(bg, list) and
              isinstance(bg[0], qpimage.QPImage)):
            # List of QPImage
            data = []
            for bgii in bg:
                data.append(self._compute_bgid(bgii))
            return hash_obj(data)
        elif (isinstance(bg, SeriesData) and
              (len(bg) == 1 or
               len(bg) == len(self))):
            # DataSet
            return bg.identifier
        else:
            raise ValueError("Unknown background data type: {}".format(bg))
1178560
private int getBucketPlacementId(DocumentURI uri, int[][] buckets,
        int numBuckets, int numForests, int uForests) {
        String nk = LegacyAssignmentPolicy.normalize(uri.getUri());
        BigInteger uriKey=LegacyAssignmentPolicy.getUriKey(nk);
        long u = uriKey.longValue();

        for (int i = 14; i <= 56; i += 14) {
            u ^= uriKey.shiftRight(i).longValue();
        }

        int bucket = (int) (u&0x3fff);
        int fIdx = buckets[numForests - 1][bucket];
        boolean allUpdatble = numForests == uForests;
        if (!allUpdatble) {
            int[] partv = new int[uForests];
            int j = 0;
            for (int i = 0; i < numForests; i++) {
                if (isUpdatable(i)) {
                    partv[j++] = i;
                }
            }
            fIdx = partv[LegacyAssignmentPolicy.getPlacementId(uri, uForests)];
        }
        return fIdx;
    }
1244989
private boolean matches6004( ApiDifference apiDiff )
    {
        throwIfMissing( true, false, true, true );

        if ( !SelectorUtils.matchPath( field, apiDiff.getAffectedField() ) )
        {
            return false;
        }

        String[] args = getArgs( apiDiff );
        String diffFrom = args[0];
        String diffTo = args[1];

        return SelectorUtils.matchPath( from, diffFrom ) && SelectorUtils.matchPath( to, diffTo );
    }