Commits

Anonymous committed ecacac3

Some cosmetics in similarity.js

* replacing right increment by left increment: i++ to ++i
* fixed misspellings

Comments (0)

Files changed (2)

content/similarity.js

 LevDistance.prototype = {
     minValue : function(a, b, c)
     {
-        var min = parseInt(a);
-        if(parseInt(b) < min)
-            min = parseInt(b);
-
-        if(parseInt(c) < min)
-            min = parseInt(c);
-
-        return min;
+        a = parseInt(a);
+        b = parseInt(b);
+        c = parseInt(c);
+        return a < b ? (a < c ? a : c) : (b < c ? b : c);
     },
 
     distance : function()
         if(m == 0) return n;
 
         var d;
-        for(var i = 0; i <= n; i++) {
+        for(var i = 0; i <= n; ++i) {
 	    if (i == 0) d = new Array(n+1);
-            for(var j = 0; j <= m; j++) {
+            for(var j = 0; j <= m; ++j) {
 	        if (j == 0) d[i] = new Array(m+1);
                 d[i][j] = 0;
                 d[0][j] = j;
             d[i][0] = i;
         }
 
-       for(var i = 1; i <= n; i++) {
+       for(var i = 1; i <= n; ++i) {
             var s_i = s.charAt(i - 1);
 
-            for(var j = 1; j <= m; j++) {
+            for(var j = 1; j <= m; ++j) {
                 var t_j = t.charAt(j - 1);
                 var cost = 1
                 if(s_i == t_j)
 
 function getMostSimilarTerm(termList)
 {
-    var mostSimilarTem = termList[0];
+    var mostSimilarTerm = termList[0];
 
-    for(var i = 1; i < termList.length; i++) {
-        if(termList[i].getScore() > mostSimilarTem.getScore())
-            mostSimilarTem = termList[i];
+    for(var i = 1; i < termList.length; ++i) {
+        if(termList[i].getScore() > mostSimilarTerm.getScore())
+            mostSimilarTerm = termList[i];
     }
 
-    return mostSimilarTem.getTerm();
+    return mostSimilarTerm.getTerm();
 }
 
 function doExtract(doc) {
   <Description about="urn:mozilla:install-manifest">
     <em:id>smartfind@smartfind.org</em:id>
     <em:name>Smart Find</em:name>
-    <em:version>0.2.4</em:version>
+    <em:version>0.2.3</em:version>
     <em:type>2</em:type>
     <em:creator>Roberto Oliveira dos Santos</em:creator>
     <em:contributor>Roberto Oliveira do Santos</em:contributor>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.