Class WildcardMatcher

java.lang.Object
opennlp.tools.models.WildcardMatcher

final class WildcardMatcher extends Object
Matches file names against the wildcards accepted by AbstractClassPathModelFinder.matchesWildcard(java.net.URL, String). A * matches any run of code points, including none, a ? matches exactly one code point, and every other code point stands for itself; there is no escape character. The wildcard must cover the whole input and the comparison is case-sensitive.
  • Field Details

  • Constructor Details

    • WildcardMatcher

      private WildcardMatcher()
  • Method Details

    • matches

      static boolean matches(String wildcard, String input)
      Tests whether the whole input is covered by wildcard. Both are compared by code point, so a supplementary character, or an unpaired surrogate, counts as one code point for ?. The scan keeps a single backtracking point, the most recent *, so it never takes more than wildcard.length() * input.length() steps.
      Parameters:
      wildcard - The wildcard expression. Must not be null.
      input - The text to test. Must not be null.
      Returns:
      true if input matches wildcard from start to end, false otherwise.