c# - Why are these functionally equivalent methods not discovered by VS2013's "Analyze Solution for Code Clones"? -
i select "analyze > analyze solution code clones" in vs2013 rc, expecting realize these 2 methods:
private static char getbarcodechecksumwithlegacycode(string barcodewithoutczechsum) { contract.requires(!string.isnullorwhitespace(barcodewithoutczechsum)); if (barcodewithoutczechsum.length > 6) { int = 0; int b = 0; int j = barcodewithoutczechsum.length - 1; int = j; while (i >= 0) { = + barcodewithoutczechsum[i] - 48; = - 2; } j = barcodewithoutczechsum.length - 2; = j; while (i >= 0) { b = b + barcodewithoutczechsum[i] - 48; = - 2; } = 3 * + b; b = % 10; if (b != 0) b = 10 - b; var ch = (char)(48 + b); return ch; } return ' '; } public static string getbarcodechecksum(string barcode) { int oddtotal; int oddtotaltripled; int eventotal; // positions odd or depend on length of barcode, // or more specifically, whether length odd or even, so: if (isstringofevenlen(barcode)) { oddtotal = suminsideordinals(barcode); oddtotaltripled = oddtotal * 3; eventotal = sumoutsideordinals(barcode); } else { oddtotal = sumoutsideordinals(barcode); oddtotaltripled = oddtotal * 3; eventotal = suminsideordinals(barcode); } int finaltotal = oddtotaltripled + eventotal; int modval = finaltotal % 10; int czechsum = 10 - modval; if (czechsum == 10) { return "0"; } return czechsum.tostring(); }
...are functionally equivalent. first cryptic, second (to me, perhaps because it's 1 wrote) plain. tool doesn't see them being "code clones," though.
is because method calls other methods, namely isstringofevenlen(), suminsideordinals(), , sumoutsideordinals()?
Comments
Post a Comment