File tree Expand file tree Collapse file tree 2 files changed +26
-26
lines changed
Expand file tree Collapse file tree 2 files changed +26
-26
lines changed Original file line number Diff line number Diff line change @@ -1124,6 +1124,22 @@ impl ChangeClassifier {
11241124 self . similarity_scorer = None ;
11251125 }
11261126 }
1127+
1128+ /// Detect if a change represents a function split
1129+ pub fn detect_split ( & self , source : & CodeElement , targets : & [ CodeElement ] ) -> bool {
1130+ targets. len ( ) > 1
1131+ && targets
1132+ . iter ( )
1133+ . all ( |t| t. name . contains ( & source. name ) || source. name . contains ( & t. name ) )
1134+ }
1135+
1136+ /// Detect if changes represent a function merge
1137+ pub fn detect_merge ( & self , sources : & [ CodeElement ] , target : & CodeElement ) -> bool {
1138+ sources. len ( ) > 1
1139+ && sources
1140+ . iter ( )
1141+ . all ( |s| s. name . contains ( & target. name ) || target. name . contains ( & s. name ) )
1142+ }
11271143}
11281144
11291145#[ cfg( test) ]
@@ -1456,20 +1472,3 @@ mod tests {
14561472 assert ! ( classifier. similarity_scorer. is_some( ) ) ;
14571473 }
14581474}
1459-
1460- /// Detect if a change represents a function split
1461- pub fn detect_split ( & self , source : & CodeElement , targets : & [ CodeElement ] ) -> bool {
1462- targets. len ( ) > 1
1463- && targets
1464- . iter ( )
1465- . all ( |t| t. name . contains ( & source. name ) || source. name . contains ( & t. name ) )
1466- }
1467-
1468- /// Detect if changes represent a function merge
1469- pub fn detect_merge ( & self , sources : & [ CodeElement ] , target : & CodeElement ) -> bool {
1470- sources. len ( ) > 1
1471- && sources
1472- . iter ( )
1473- . all ( |s| s. name . contains ( & target. name ) || target. name . contains ( & s. name ) )
1474- }
1475- }
Original file line number Diff line number Diff line change @@ -283,15 +283,6 @@ impl TreeEditDistance {
283283 }
284284 }
285285
286- impl Default for EditCost {
287- fn default ( ) -> Self {
288- Self {
289- insert : 1.0 ,
290- delete : 1.0 ,
291- update : 1.0 ,
292- }
293- }
294-
295286 /// Preprocess tree to extract information needed for Zhang-Shasha algorithm
296287 fn preprocess_tree ( & self , tree : & ASTNode ) -> TreeInfo {
297288 let node_count = self . count_nodes ( tree) ;
@@ -581,6 +572,16 @@ impl Default for EditCost {
581572 }
582573}
583574
575+ impl Default for EditCost {
576+ fn default ( ) -> Self {
577+ Self {
578+ insert : 1.0 ,
579+ delete : 1.0 ,
580+ update : 1.0 ,
581+ }
582+ }
583+ }
584+
584585#[ cfg( test) ]
585586mod tests {
586587 use super :: * ;
You can’t perform that action at this time.
0 commit comments