A named computation that can be carried out on some nodes. Example include complexity metrics, like cyclomatic complexity.
Use with MetricsUtil
, for example, in the Java module:
if (JavaMetrics.CYCLO.supports(node)) {
int cyclo = MetricsUtil.computeMetric(JavaMetrics.CYCLO, node);
...
}
Note that the supports
check is necessary (metrics cannot necessarily be computed on any node of the type they support).
Metrics support a concept of options, which can be passed to compute
or MetricsUtil.computeMetric(Metric, Node, MetricOptions)
.
Metric instances are stateless by contract.
To implement your own metrics, use the factory method of
. Be aware though, that you cannot register a custom metric into a LanguageMetricsProvider
, which means your metric will not be available from XPath.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4