Package net.sourceforge.pmd.lang.metrics
Interface LanguageMetricsProvider<T extends QualifiableNode,O extends QualifiableNode>
-
- Type Parameters:
T
- Type of type declaration nodes of the languageO
- Type of operation declaration nodes of the language
@Experimental public interface LanguageMetricsProvider<T extends QualifiableNode,O extends QualifiableNode>
Language-specific provider for metrics. Knows about all the metrics defined for a language. Can be used e.g. to build GUI applications like the designer, in a language independent way. Accessible throughLanguageVersionHandler.getLanguageMetricsProvider()
. Note: this is experimental, ie unstable until 7.0.0, after which it will probably be promoted to a real API.- Since:
- 6.11.0
- Author:
- Clément Fournier
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description O
asOperationNode(Node anyNode)
Returns the given node casted toLanguageMetricsProvider
if it's of the correct type, otherwise returns null.T
asTypeNode(Node anyNode)
Returns the given node casted toLanguageMetricsProvider
if it's of the correct type, otherwise returns null.Map<MetricKey<?>,Double>
computeAllMetricsFor(Node node)
Computes all metrics available on the given node.double
computeForOperation(MetricKey<O> key, O node, MetricOptions options)
LikeMetricsComputer.computeForOperation(MetricKey, QualifiableNode, boolean, MetricOptions, MetricMemoizer)
but performs no memoisation.double
computeForType(MetricKey<T> key, T node, MetricOptions options)
LikeMetricsComputer.computeForType(MetricKey, QualifiableNode, boolean, MetricOptions, MetricMemoizer)
, but performs no memoisation.double
computeWithResultOption(MetricKey<O> key, T node, MetricOptions options, ResultOption option)
LikeMetricsComputer.computeWithResultOption(MetricKey, QualifiableNode, boolean, MetricOptions, ResultOption, ProjectMemoizer)
but performs no memoisation.List<? extends MetricKey<O>>
getAvailableOperationMetrics()
Returns a list of all supported operation metric keys for the language.List<? extends MetricKey<T>>
getAvailableTypeMetrics()
Returns a list of all supported type metric keys for the language.
-
-
-
Method Detail
-
getAvailableTypeMetrics
List<? extends MetricKey<T>> getAvailableTypeMetrics()
Returns a list of all supported type metric keys for the language.
-
getAvailableOperationMetrics
List<? extends MetricKey<O>> getAvailableOperationMetrics()
Returns a list of all supported operation metric keys for the language.
-
asTypeNode
T asTypeNode(Node anyNode)
Returns the given node casted toLanguageMetricsProvider
if it's of the correct type, otherwise returns null.
-
asOperationNode
O asOperationNode(Node anyNode)
Returns the given node casted toLanguageMetricsProvider
if it's of the correct type, otherwise returns null.
-
computeForType
double computeForType(MetricKey<T> key, T node, MetricOptions options)
LikeMetricsComputer.computeForType(MetricKey, QualifiableNode, boolean, MetricOptions, MetricMemoizer)
, but performs no memoisation.
-
computeForOperation
double computeForOperation(MetricKey<O> key, O node, MetricOptions options)
LikeMetricsComputer.computeForOperation(MetricKey, QualifiableNode, boolean, MetricOptions, MetricMemoizer)
but performs no memoisation.
-
computeWithResultOption
double computeWithResultOption(MetricKey<O> key, T node, MetricOptions options, ResultOption option)
LikeMetricsComputer.computeWithResultOption(MetricKey, QualifiableNode, boolean, MetricOptions, ResultOption, ProjectMemoizer)
but performs no memoisation.
-
computeAllMetricsFor
Map<MetricKey<?>,Double> computeAllMetricsFor(Node node)
Computes all metrics available on the given node. The returned results may contain Double.NaN as a value.- Parameters:
node
- Node to inspect- Returns:
- A map of metric key to their result, possibly empty, but with no null value
-
-