Package com.nimbusds.common.monitor
Class WildCardMetricFilter
java.lang.Object
com.nimbusds.common.monitor.WildCardMetricFilter
- All Implemented Interfaces:
com.codahale.metrics.MetricFilter
Wild card metric filter.
-
Field Summary
Fields inherited from interface com.codahale.metrics.MetricFilter
ALL
-
Constructor Summary
ConstructorDescriptionWildCardMetricFilter
(List<String> whiteList) Creates a new wild card metrics filter. -
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<String>
getMatches
(String t, String p) Simple computation of the longest common extension (LCE) of two given strings, beginning at two given indices.Returns the white list.static int
longestCommonExtension
(String t1, int i1, String t2, int i2) This method takes four parameters: t1 and t2 (the two strings) and two indices i1 and i2 (the index to start at in t1 and t2).boolean
boolean
Returnstrue
if the filter will match no metric.boolean
Returnstrue
if the filter will match any metric.
-
Constructor Details
-
WildCardMetricFilter
Creates a new wild card metrics filter.- Parameters:
whiteList
- The white list entries,null
if none.
-
-
Method Details
-
getWhiteList
Returns the white list.- Returns:
- The white list,
null
if none.
-
matchesNone
Returnstrue
if the filter will match any metric.- Returns:
true
if any metric will be matched, elsefalse
.
-
matchesAny
Returnstrue
if the filter will match no metric.- Returns:
true
if no metric will be matched, elsefalse
.
-
matches
- Specified by:
matches
in interfacecom.codahale.metrics.MetricFilter
-
longestCommonExtension
This method takes four parameters: t1 and t2 (the two strings) and two indices i1 and i2 (the index to start at in t1 and t2). It returns the length of the longest common extension starting at i1 in t1 and at i2 in t2. The method simply iterates over the given strings, starting at the given indices. It compares the characters, counts equal characters and returns that number as soon as the characters differ. -
getMatches
Simple computation of the longest common extension (LCE) of two given strings, beginning at two given indices. The LCE computation is part of different algorithms in inexact string matching (Gusfield 1999:196). This simple implementation has a runtime complexity of O(n). Computation in O(1) is possible through constant-time retrieval of Lowest Common Ancestors (LCA) in suffix trees (after linear-time preprocessing). See Gusfield 1999:181 for further reference on constant time LCA retrieval and Gusfield 1999:196 for constant time LCE computation using the LCA.References: Gusfield, Dan (1999), Algorithms on Strings, Sequences and Trees, Cambridge: University Press.
An implementation of string matching with wildcards, as described in Gusfield 1999:199. When used with a longest common extension computation with suffix trees, it allows for searching a pattern with k wildcards in a text T of length m in O(km) time (Gusfield 1999:199). This implementation uses a simple computation of the longest common extension.
-