public static double getCoverage ( List < MathNode > refLeafs , List < MathNode > compLeafs ) { if ( compLeafs . size ( ) == 0 ) { return 1. ; } HashMultiset < MathNode > tmp = HashMultiset . create ( ) ; tmp . addAll ( compLeafs ) ; tmp . removeAll ( refLeafs ) ; return 1 - ( double ) tmp . size ( ) / ( double ) compLeafs . size ( ) ; }
Calculate the coverage factor between two trees whereas only their leafs are considered . Leafs are typically identifiers or constants .