Check if a matching rendition is found for any of the provided media formats and other media args.
The first match is returned.
@param media Media
@param asset Asset
@param mediaArgs Media args
@return true if a rendition was found
420003
private boolean resolveFirstMatchRenditions(Media media, Asset asset, MediaArgs mediaArgs) {
    Rendition rendition = asset.getRendition(mediaArgs);
    if (rendition != null) {
      media.setRenditions(ImmutableList.of(rendition));
      media.setUrl(rendition.getUrl());
      return true;
    }
    return false;
  }
768617
public @NotNull MediaArgs mediaFormat(MediaFormat value) {
    if (value == null) {
      this.mediaFormats = null;
    }
    else {
      this.mediaFormats = new MediaFormat[] {
          value
      };
    }
    return this;
  }
1038531
def has_provider_support(provider, media_type):
    
    if provider.lower() not in API_ALL:
        return False
    provider_const = "API_" + media_type.upper()
    return provider in globals().get(provider_const, {})
336779
private void addRendition(Set<RenditionMetadata> candidates, Rendition rendition, MediaArgs mediaArgs) {
    // ignore AEM-generated thumbnail renditions unless allowed via mediaargs
    if (!mediaArgs.isIncludeAssetThumbnails() && AssetRendition.isThumbnailRendition(rendition)) {
      return;
    }
    // ignore AEM-generated web renditions unless allowed via mediaargs
    boolean isIncludeAssetWebRenditions = mediaArgs.isIncludeAssetWebRenditions() != null
        ? mediaArgs.isIncludeAssetWebRenditions()
        : true;
    if (!isIncludeAssetWebRenditions && AssetRendition.isWebRendition(rendition)) {
      return;
    }
    RenditionMetadata renditionMetadata = createRenditionMetadata(rendition);
    candidates.add(renditionMetadata);
  }
341062
function _mediaMatch(object, key, value) {
  if (!{}.hasOwnProperty.call(object, key)) {
    return false;
  }
  return Boolean(object[key].indexOf(value) >= 0);
}
74597
public static boolean hasWebArgumentMetadata(final JCas jCas)
    {
        FSIterator<FeatureStructure> iterator = jCas.getCas().getIndexRepository().getAllIndexedFS(
                CasUtil.getType(jCas.getCas(), WebArgumentMetadata.class));

        return iterator.hasNext();
    }
102278
public boolean mediaIsImage() {
        String contentType = this.getContentType();
        return contentType != null && this.media != null && contentType.startsWith("image") && !contentType.equals("image/gif");
    }
834036
public function removeAsset(Asset $asset): bool
    {
        if ($asset->getAssetCollections()->contains($this) === false) {
            $this->assets->removeElement($asset);
            return true;
        }
        return false;
    }
202184
function assetParse (value) {
  var el;
  var parsedUrl;

  // If an element was provided (e.g. canvas or video), just return it.
  if (typeof value !== 'string') { return value; }

  // Wrapped `url()` in case of data URI.
  parsedUrl = value.match(urlRegex);
  if (parsedUrl) { return parsedUrl[1]; }

  // ID.
  if (value.charAt(0) === '#') {
    el = document.getElementById(value.substring(1));
    if (el) {
      // Pass through media elements. If we have the elements, we don't have to call
      // three.js loaders which would re-request the assets.
      if (el.tagName === 'CANVAS' || el.tagName === 'VIDEO' || el.tagName === 'IMG') {
        return el;
      }
      return el.getAttribute('src');
    }
    warn('"' + value + '" asset not found.');
    return;
  }

  // Non-wrapped url().
  return value;
}
456374
public function addAsset(Asset $asset): bool
    {
        if ($asset->getAssetCollections()->contains($this) === false) {
            $this->assets->add($asset);
            return true;
        }

        return false;
    }
597115
public static boolean matchesConfiguredImages(String imageList, ImageConfiguration imageConfig) {
        if (imageList == null) {
            return true;
        }
        Set<String> imagesAllowed = new HashSet<>(Arrays.asList(imageList.split("\\s*,\\s*")));
        return imagesAllowed.contains(imageConfig.getName()) || imagesAllowed.contains(imageConfig.getAlias());
    }
769583
public boolean contains(final MediaTypes types) {
        boolean contains = false;
        for (final MediaType type : types.list) {
            if (this.contains(type)) {
                contains = true;
                break;
            }
        }
        return contains;
    }
682789
@Override
    public final boolean matches(Object item, Description mismatch) {
        if (matches(item)) {
            return true;
        } else {
            describeMismatch(item, mismatch);
            return false;
        }
    }
1059150
private static void checkMediaType(Multimap<MediaType, SerializationFormat> simplifiedMediaTypeToFormats,
                                       MediaType mediaType) {
        final MediaType simplifiedMediaType = mediaType.withoutParameters();
        for (SerializationFormat format : simplifiedMediaTypeToFormats.get(simplifiedMediaType)) {
            for (MediaType registeredMediaType : format.mediaTypes()) {
                checkState(!registeredMediaType.is(mediaType) && !mediaType.is(registeredMediaType),
                           "media type registered already: ", mediaType);
            }
        }
    }
40790
public boolean matches(MediaExpression e)
    {
        String fs = e.getFeature();
        boolean isMin = false;
        boolean isMax = false; 
        if (fs.startsWith("min-")) { isMin = true; fs = fs.substring(4); }
        else if (fs.startsWith("max-")) { isMax = true; fs = fs.substring(4); }
        
        Feature feature = getFeatureByName(fs);
        if (feature != null &&  (!(isMin || isMax) || feature.isPrefixed())) //the name (including prefixes) is allowed
        {
            switch (feature)
            {
                case WIDTH:
                    return valueMatches(getExpressionLengthPx(e), width, isMin, isMax);
                case HEIGHT:
                    return valueMatches(getExpressionLengthPx(e), height, isMin, isMax);
                case DEVICE_WIDTH:
                    return valueMatches(getExpressionLengthPx(e), deviceWidth, isMin, isMax);
                case DEVICE_HEIGHT:
                    return valueMatches(getExpressionLengthPx(e), deviceHeight, isMin, isMax);
                case ORIENTATION:
                    String oid = getExpressionIdentifier(e);
                    if (oid == null)
                        return false;
                    else if (oid.equals("portrait"))
                        return isPortrait();
                    else if (oid.equals("landscape"))
                        return !isPortrait();
                    else
                        return false;
                case ASPECT_RATIO:
                    return valueMatches(getExpressionRatio(e), getAspectRatio(), isMin, isMax);
                case DEVICE_ASPECT_RATIO:
                    return valueMatches(getExpressionRatio(e), getDeviceAspectRation(), isMin, isMax);
                case COLOR:
                    return valueMatches(getExpressionInteger(e), color, isMin, isMax);
                case COLOR_INDEX:
                    return valueMatches(getExpressionInteger(e), colorIndex, isMin, isMax);
                case MONOCHROME:
                    return valueMatches(getExpressionInteger(e), monochrome, isMin, isMax);
                case RESOLUTION:
                    return valueMatches(getExpressionResolution(e), resolution, isMin, isMax);
                case SCAN:
                    String sid = getExpressionIdentifier(e);
                    if (sid == null)
                        return false;
                    else if (sid.equals("progressive"))
                        return !scanInterlace;
                    else if (sid.equals("interlace"))
                        return scanInterlace;
                    else
                        return false;
                case GRID:
                    Integer gval = getExpressionInteger(e);
                    if (gval == null)
                        return false;
                    else if (gval == 0 || gval == 1) //0 and 1 are the only allowed values
                        return gval == grid;
                    else
                        return false;
                default:
                    return false;
            }
        }
        else
            return false; //results in "not all" for the whole query
    }
1085595
public static boolean isImage(Media media)
    {
        try
        {
            for (final ImageHeaderReader reader : FORMATS)
            {
                if (reader.is(media))
                {
                    return true;
                }
            }
            return false;
        }
        catch (@SuppressWarnings("unused") final LionEngineException exception)
        {
            return false;
        }
    }
572716
public function matchesMediaType(string $mediaType): bool
    {
        foreach ($this->mediaTypePatterns as $mediaTypePattern) {
            if ($mediaTypePattern->matches($mediaType)) {
                return true;
            }
        }
        return false;
    }