Class EditClassCount
java.lang.Object
org.variantsync.diffdetective.metadata.EditClassCount
- All Implemented Interfaces:
Metadata<EditClassCount>
Metadata that tracks how often edit classes were matched.
- Author:
- Paul Bittner
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Counts the occurrences of a data point across commits. -
Field Summary
Modifier and TypeFieldDescriptionstatic final AnalysisResult.ResultKey<EditClassCount>
private final LinkedHashMap<EditClass,
EditClassCount.Occurrences> -
Constructor Summary
ConstructorDescriptionEditClassCount
(EditClassCatalogue editClasses) Create a new empty count that reports occurrences of the given edit class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the current occurrence count for each considered edit class.static org.variantsync.functjonal.category.InplaceSemigroup<EditClassCount>
Composes two edit class counts by composing their respective occurrence counts for each edit class.static EditClassCount
Parses lines containingedit classes
toEditClassCount
.void
reportOccurrenceFor
(EditClass editClass, CommitDiff commit) Report the match of the given edit class in the given commit diff.org.variantsync.functjonal.category.InplaceSemigroup<EditClassCount>
Mutates and returns first element.void
setFromSnapshot
(LinkedHashMap<String, String> snap) snapshot()
Create a key-value store of the metadata that can be used for serialization.
-
Field Details
-
KEY
-
occurrences
-
-
Constructor Details
-
EditClassCount
Create a new empty count that reports occurrences of the given edit class.- Parameters:
editClasses
- edit classes whose occurrences should be counted.
-
-
Method Details
-
ISEMIGROUP
Composes two edit class counts by composing their respective occurrence counts for each edit class.- See Also:
-
reportOccurrenceFor
Report the match of the given edit class in the given commit diff. The count of the given edit class will be incremented and the commit will be memorized as one of the commits in which this edit class was matched.- Parameters:
editClass
- The edit class that was matched.commit
- The CommitDiff in which the edit class match occurred.- Throws:
AssertionError
- when the given edit class is not present this counts catalog.- See Also:
-
parse
Parses lines containingedit classes
toEditClassCount
.- Parameters:
lines
- Lines containingedit classes
to be parsed- Returns:
EditClassCount
-
snapshot
Description copied from interface:Metadata
Create a key-value store of the metadata that can be used for serialization.- Specified by:
snapshot
in interfaceMetadata<EditClassCount>
- Returns:
- A LinkedHashMap that stores all relevant properties to export. The return type has to be a LinkedHashMap to obtain insertion-order iteration.
-
setFromSnapshot
- Specified by:
setFromSnapshot
in interfaceMetadata<EditClassCount>
-
semigroup
Mutates and returns first element.- Specified by:
semigroup
in interfaceMetadata<EditClassCount>
-
getOccurrences
Returns the current occurrence count for each considered edit class.
-