Skip to main content

Table 2 Types of variants among the source code patterns

From: Method-level code clone detection through LWH (Light Weight Hybrid) approach

S.No

Equivalence category

Possible constructs

Proposed pattern

1

Iterative equivalence

for

iteration

while

<initial>

do-while

<condition>

 

<incre/decre>

2

Conditional equivalence

if

selection

else

<condition>

else-if

 

?:

 

switch

 

3

Input equivalence

scanf

read <variable>

system.in

 

input.readline

 

4

Output equivalence

printf

write <variable>

system.out

 

5

Declaration equivalence

int

Multiple Declaration

char

to Single line declaration

float

 

double

Example

string

int x

 

int y

Example

int z

int x,y,z

char c

char c,s

char s

6

Braces

{ }

Braces are removed in the code