com.hadii.stiff.metrics.FanOutMetric Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stiff-lib Show documentation
Show all versions of stiff-lib Show documentation
stiff-lib is a java library for generating stiff diagrams.
The newest version!
package com.hadii.stiff.metrics;
import com.hadii.clarpse.reference.ComponentReference;
import com.hadii.clarpse.sourcemodel.Component;
import java.util.HashSet;
import java.util.Set;
/**
* Represents the Fanout metric, which is a measure of the number of other classes referenced by a class.
*/
public class FanOutMetric implements Metric {
private final Component component;
public FanOutMetric(Component component) {
this.component = component;
}
public double value() {
Set referencedComponents = new HashSet<>();
for (ComponentReference invocation : this.component.references()) {
referencedComponents.add(invocation.invokedComponent());
}
return referencedComponents.size();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy