Package org.somox.metrics.util
Class AccessCacheGraph
java.lang.Object
org.somox.metrics.util.AccessCacheGraph
Class used to encapsulate all computations based on the number of accesses between two pairwise
GASTClasses
-
Constructor Summary
ConstructorDescriptionAccessCacheGraph
(org.jgrapht.DirectedGraph<org.emftext.language.java.classifiers.ConcreteClassifier, ClassAccessGraphEdge> accessGraph) Constructor of the access cache -
Method Summary
Modifier and TypeMethodDescriptionlong
calculateNumberOfAccessesToClassesInSet
(Set<org.emftext.language.java.classifiers.ConcreteClassifier> sourceClasses, Set<org.emftext.language.java.classifiers.ConcreteClassifier> targetClasses) Counts all directed accesses from any of the source classes to any of the target classes.long
calculateNumberOfExternalAccesses
(Set<org.emftext.language.java.classifiers.ConcreteClassifier> sourceClasses) Calculates the number of outgoing accesses of any class inlong
calculateNumberOfIncommingAccesses
(Set<org.emftext.language.java.classifiers.ConcreteClassifier> sourceClasses) Compute the number of accesses coming from any class outside and going to the set of classes givenlong
calculateNumberOfInternalAccesses
(Set<org.emftext.language.java.classifiers.ConcreteClassifier> sourceClasses) Calculates the number of inner accesses of any class in
-
Constructor Details
-
AccessCacheGraph
public AccessCacheGraph(org.jgrapht.DirectedGraph<org.emftext.language.java.classifiers.ConcreteClassifier, ClassAccessGraphEdge> accessGraph) Constructor of the access cache- Parameters:
accessGraph
- A graph containing as nodes all GASTClasses considered in the Somox run and as edges the number of directed accesses between the two connected classes
-
-
Method Details
-
calculateNumberOfAccessesToClassesInSet
public long calculateNumberOfAccessesToClassesInSet(Set<org.emftext.language.java.classifiers.ConcreteClassifier> sourceClasses, Set<org.emftext.language.java.classifiers.ConcreteClassifier> targetClasses) Counts all directed accesses from any of the source classes to any of the target classes. (Does not consider inverse accesses.)- Parameters:
sourceClasses
- A set of source classes (nodes in the cache graph)targetClasses
- A set of target classes (nodes in the cache graph)- Returns:
- count of accesses The number of total accesses from sourceClasses to targetClasses
-
calculateNumberOfIncommingAccesses
public long calculateNumberOfIncommingAccesses(Set<org.emftext.language.java.classifiers.ConcreteClassifier> sourceClasses) Compute the number of accesses coming from any class outside and going to the set of classes given- Parameters:
sourceClasses
- A set of classes for which the incoming accesses are counted- Returns:
- The total number of incoming accesses to the set of classes
-
calculateNumberOfExternalAccesses
public long calculateNumberOfExternalAccesses(Set<org.emftext.language.java.classifiers.ConcreteClassifier> sourceClasses) Calculates the number of outgoing accesses of any class insourceClasses
to any class not contained in source classes.- Parameters:
sourceClasses
- The set of classes- Returns:
- Count of accesses
-
calculateNumberOfInternalAccesses
public long calculateNumberOfInternalAccesses(Set<org.emftext.language.java.classifiers.ConcreteClassifier> sourceClasses) Calculates the number of inner accesses of any class insourceClasses
to any class contained in source classes.- Parameters:
sourceClasses
-- Returns:
- Count of accesses
-