MCPcopy Index your code
hub / github.com/benfry/processing4 / matchPattern

Method matchPattern

core/src/processing/core/PApplet.java:8478–8496  ·  view source on GitHub ↗
(String regexp)

Source from the content-addressed store, hash-verified

8476 static protected LinkedHashMap<String, Pattern> matchPatterns;
8477
8478 static Pattern matchPattern(String regexp) {
8479 Pattern p = null;
8480 if (matchPatterns == null) {
8481 matchPatterns = new LinkedHashMap<>(16, 0.75f, true) {
8482 @Override
8483 protected boolean removeEldestEntry(Map.Entry<String, Pattern> eldest) {
8484 // Limit the number of match patterns at 10 most recently used
8485 return size() == 10;
8486 }
8487 };
8488 } else {
8489 p = matchPatterns.get(regexp);
8490 }
8491 if (p == null) {
8492 p = Pattern.compile(regexp, Pattern.MULTILINE | Pattern.DOTALL);
8493 matchPatterns.put(regexp, p);
8494 }
8495 return p;
8496 }
8497
8498
8499 /**

Callers 2

matchMethod · 0.95
matchAllMethod · 0.95

Calls 3

getMethod · 0.65
compileMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected