Skip to main content

structural_clone_group_fingerprint

Function structural_clone_group_fingerprint 

Source
pub fn structural_clone_group_fingerprint(
    variant: &BuildVariant,
    class: CloneClass,
    canonical: &FragmentFingerprint,
    members: &[FragmentFingerprint],
) -> CloneGroupFingerprint
Expand description

Fingerprint a Structural (Type-3) clone group, anchored on its canonical instance.

A Type-3 group’s members are similar but not identical, so — unlike a Type-1/2 group, whose members share one content fingerprint — there is no single content to hash. The group is instead identified by its canonical instance (the medoid, see crate::grouping) and the order-independent, deduplicated set of its members’ own content fingerprints. Anchoring on the medoid keeps the identity tied to a concrete instance; folding in the whole member set means adding genuinely new member content changes the fingerprint, while reordering members or repeating identical content does not.

The canonical fingerprint should also appear in members; it is hashed a second time, in a distinct anchor position, so two groups with the same member set but different medoids hash apart.