Search in sources :

Example 1 with MatcherList

use of nl.basjes.parse.useragent.analyze.MatcherList in project yauaa by nielsbasjes.

the class AbstractUserAgentAnalyzerDirect method initializeMatchers.

public synchronized void initializeMatchers() {
    if (matchersHaveBeenInitialized) {
        return;
    }
    LOG.info("Initializing Analyzer data structures");
    if (allMatchers.isEmpty()) {
        throw new InvalidParserConfigurationException("No matchers were loaded at all.");
    }
    long start = System.nanoTime();
    allMatchers.forEach(Matcher::initialize);
    long stop = System.nanoTime();
    matchersHaveBeenInitialized = true;
    LOG.info("Built in {} msec : Hashmap {}, Ranges map:{}", (stop - start) / 1000000, informMatcherActions.size(), informMatcherActionRanges.size());
    for (Matcher matcher : allMatchers) {
        if (matcher.getActionsThatRequireInput() == 0) {
            zeroInputMatchers.add(matcher);
        }
    }
    // Reset all Matchers
    for (Matcher matcher : allMatchers) {
        matcher.reset();
    }
    touchedMatchers = new MatcherList(32);
}
Also used : MatcherList(nl.basjes.parse.useragent.analyze.MatcherList) InvalidParserConfigurationException(nl.basjes.parse.useragent.analyze.InvalidParserConfigurationException) Matcher(nl.basjes.parse.useragent.analyze.Matcher)

Aggregations

InvalidParserConfigurationException (nl.basjes.parse.useragent.analyze.InvalidParserConfigurationException)1 Matcher (nl.basjes.parse.useragent.analyze.Matcher)1 MatcherList (nl.basjes.parse.useragent.analyze.MatcherList)1