/*
(non-Javadoc)
@see
org.openscience.cdk.isomorphism.matchers.smarts.SMARTSAtom#matches(org
.openscience.cdk.interfaces.IAtom)
439859
@Override
    public boolean matches(IAtom atom) {
        // h counts should be set before match throw runtime exception?
        if (atom.getImplicitHydrogenCount() == null)
            return false;
        return atom.getImplicitHydrogenCount() == hcount;
    }
623753
@Override
    public boolean matches(IAtomContainer targetContainer, IBond targetBond) {
        if (this.smartQueryBond != null && queryBond == null) {
            return smartQueryBond.matches(targetBond);
        } else {
            if (!isBondMatchFlag()) {
                return true;
            }
            if (isBondMatchFlag() && isBondTypeMatch(targetBond)) {
                return true;
            }
            if (isBondMatchFlag() && this.unsaturation == getUnsaturation(targetContainer, targetBond)) {
                return true;
            }
        }
        return false;
    }
84928
public boolean matches(String name) {
		if (name == null) {
			return pattern.equals("");
		}
		if (all != null) {
			return all.equals(name);
		}
		if (middle != null) {
			return name.contains(middle);
		}
		if (start != null && !name.startsWith(start)) {
			return false;
		}

		return end == null || name.endsWith(end);
	}
79659
@Override
    public boolean matches(String fileName) {
        // Special case: if no classes or packages have been defined,
        // then the screener matches all class files.
        if (patternList.isEmpty()) {
            return true;
        }

        LOG.debug("Matching: {}", fileName);

        // Scan through list of regexes
        for (Matcher matcher : patternList) {
            matcher.reset(fileName);
            if (matcher.find()) {
                LOG.debug("\\tTrying [{}]: yes!", matcher.pattern());
                return true;
            }
            LOG.debug("\\tTrying [{}]: no", matcher.pattern());
        }
        return false;
    }
185283
public String getMatch(final byte[] content) throws IOException {
		final ByteBuffer buf = readBuffer(content);
		if (buf == null) {
			return null;
		}
		buf.position(0);
		final boolean matches = match(buf);
		if (matches) {
			final int subLen = this.subEntries.size();
			final String myMimeType = getMimeType();
			if (subLen > 0) {
				String mtype = null;
				for (int k = 0; k < subLen; k++) {
					final MagicMimeEntry me = this.subEntries.get(k);
					mtype = me.getMatch(content);
					if (mtype != null) {
						return mtype;
					}
				}
				if (myMimeType != null) {
					return myMimeType;
				}
			} else {
				return myMimeType;
			}
		}

		return null;
	}
519919
public final boolean matches(@NotNull final String targetPath) {
        Contract.requireArgNotNull("targetPath", targetPath);
        if (regExpr == null) {
            return true;
        }
        return regExpr.matcher(targetPath).find();
    }
87244
public boolean matches(ESigItem item) {
        if (selected != null && item.isSelected() != selected) {
            return false;
        }
        
        if (eSigType != null && !item.getESigType().equals(eSigType)) {
            return false;
        }
        
        if (session != null && !item.getSession().equals(session)) {
            return false;
        }
        
        if (ids != null && !ids.contains(item.getId())) {
            return false;
        }
        
        return true;
    }
731133
@Override
    public boolean matches(IAtom atom) {
        if (!atom.getSymbol().equals("H")) {
            return false;
        }

        if (atom.getFormalCharge() == 1) { // proton matches
            return true;
        }

        // hydrogens connected to other hydrogens, e.g., molecular hydrogen
        List<IAtom> list = invariants(atom).target().getConnectedAtomsList(atom);
        for (IAtom connAtom : list) {
            if (connAtom.getSymbol().equals("H")) {
                return true;
            }
        }

        // hydrogens connected to other than one other atom, e.g., bridging hydrogens
        if (invariants(atom).degree() > 1) {
            return true;
        }

        //isotopic hydrogen specifications, e.g. deuterium [2H] or tritium etc
        if (atom.getMassNumber() != null) {
            if (getMassNumber().intValue() == atom.getMassNumber().intValue()) return true;
        } else {
            // target atom is [H], so make sure query atom has mass number = 1
            if (getMassNumber() == 1) return true;
        }

        return false;
    }
193508
public static boolean matches(Pattern patternMatcher, Collection<Filter> filters, Extension extension)
    {
        if (matches(patternMatcher, extension.getId().getId(), extension.getDescription(), extension.getSummary(),
            extension.getName(), ExtensionIdConverter.toStringList(extension.getExtensionFeatures()))) {
            for (Filter filter : filters) {
                if (!matches(filter, extension)) {
                    return false;
                }
            }

            return true;
        }

        return false;
    }
424830
public boolean matches(final Node node) throws IllegalArgumentException {
        // Precondition checks
        if (node == null) {
            throw new IllegalArgumentException("node must be specified");
        }

        if (!name.equals(node.getName())) {
            return false;
        }

        if ((text != null && node.getText() == null) || (text != null && !text.trim().equals(node.getText().trim()))) {
            return false;
        }

        if (attributes != null) {
            for (final Map.Entry<String, String> attribute : attributes.entrySet()) {
                final String attrValue = attribute.getValue();
                final String attrName = attribute.getKey();

                if (!attrValue.equals(node.getAttribute(attrName))) {
                    return false;
                }
            }
        }

        return true;
    }
179757
private static boolean argsMatch(AbstractExpression e1, AbstractExpression e2) {
        final List<AbstractExpression> args1 = e1.getArgs(), args2 = e2.getArgs();
        if (args1 == null || args2 == null) {
            return args1 == args2;
        } else {
            return args1.size() == args2.size() &&
                    IntStream.range(0, args1.size())
                    .mapToObj(index -> (new FilterMatcher(args1.get(index), args2.get(index))).match())
                    .reduce(Boolean::logicalAnd).get();
        }
    }
194468
public boolean matches(URL url) {
        boolean matches = false;
        if(wildcardMatches(protocol, url.getProtocol()) && wildcardMatches(host, url.getHost()) && wildcardMatches(getPath(), url.getPath())) {
            matches = true;
        }
        return matches;
    }
1314487
@Override
    public <I> MatchResult<I> matchResult(I item) {
        StringDescription mismatch = new StringDescription();
        if (matches(item, mismatch)) {
            return new MatchResultSuccess<>(item, this);
        } else {
            return new MatchResultMismatch<>(item, this, mismatch.toString());
        }
    }
865628
public boolean matches(Evidence evidence) {
        return sourceMatches(evidence)
                && confidenceMatches(evidence)
                && name.equalsIgnoreCase(evidence.getName())
                && valueMatches(evidence);
    }
972713
public static boolean match(WildcardPattern[] patterns, String value) {
    for (WildcardPattern pattern : patterns) {
      if (pattern.match(value)) {
        return true;
      }
    }
    return false;
  }
1087576
public boolean couldMatchAtomType(IAtomContainer atomContainer, IAtom atom, IAtomType atomType) {
        logger.debug("   ... matching atom ", atom.getSymbol(), " vs ", atomType);
        if (atomContainer.getBondOrderSum(atom) + atom.getImplicitHydrogenCount() < atomType.getBondOrderSum()) {
            logger.debug("    Match!");
            return true;
        }
        logger.debug("    No Match");
        return false;
    }
612492
boolean matches(String value) {
    if (pattern == null) {
      return true;
    }
    return pattern.matcher(value).matches();
  }