Thread: [Htmlparser-cvs] htmlparser/src/org/htmlparser/util/sort Ordered.java,1.5,1.6 Sort.java,1.5,1.6 Sort
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-09-10 03:54:12
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/util/sort In directory sc8-pr-cvs1:/tmp/cvs-serv24483/src/org/htmlparser/util/sort Modified Files: Ordered.java Sort.java Sortable.java package.html Log Message: Add style checking target to ant build script: ant checkstyle It uses a jar from http://checkstyle.sourceforge.net which is dropped in the lib directory. The rules are in the file htmlparser_checks.xml in the src directory. Added lexerapplications package with Tabby as the first app. It performs whitespace manipulation on source files to follow the style rules. This reduced the number of style violations to roughly 14,000. There are a few issues with the style checker that need to be resolved before it should be taken too seriously. For example: It thinks all method arguments should be final, even if they are modified by the code (which the compiler frowns on). It complains about long lines, even when there is no possibility of wrapping the line, i.e. a URL in a comment that's more than 80 characters long. It considers all naked integers as 'magic numbers', even when they are obvious, i.e. the 4 corners of a box. It complains about whitespace following braces, even in array initializers, i.e. X[][] = { {a, b} { } } But it points out some really interesting things, even if you don't agree with the style guidelines, so it's worth a look. Index: Ordered.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/util/sort/Ordered.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Ordered.java 8 Sep 2003 02:26:33 -0000 1.5 --- Ordered.java 10 Sep 2003 03:38:25 -0000 1.6 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,31 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com ! // ! // This class was contributed by // Derrick Oswald // --- 18,31 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com ! // ! // This class was contributed by // Derrick Oswald // *************** *** 62,66 **** * Returns a negative integer, zero, or a positive integer * as this object is less than, equal to, or greater ! * than the second. * <p> * The implementor must ensure that --- 62,66 ---- * Returns a negative integer, zero, or a positive integer * as this object is less than, equal to, or greater ! * than the second. * <p> * The implementor must ensure that *************** *** 68,72 **** * for all x and y. (This implies that <code>x.compare(y)</code> * must throw an exception if and only if <code>y.compare(x)</code> ! * throws an exception.) * <p> * The implementor must also ensure that the relation is transitive: --- 68,72 ---- * for all x and y. (This implies that <code>x.compare(y)</code> * must throw an exception if and only if <code>y.compare(x)</code> ! * throws an exception.) * <p> * The implementor must also ensure that the relation is transitive: Index: Sort.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/util/sort/Sort.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Sort.java 8 Sep 2003 02:26:33 -0000 1.5 --- Sort.java 10 Sep 2003 03:38:25 -0000 1.6 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,31 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com ! // ! // This class was contributed by // Derrick Oswald // --- 18,31 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com ! // ! // This class was contributed by // Derrick Oswald // *************** *** 356,360 **** { QuickSort (sortable, sortable.first (), sortable.last ()); ! } /** --- 356,360 ---- { QuickSort (sortable, sortable.first (), sortable.last ()); ! } /** *************** *** 406,410 **** int result; int ret; ! ret = -1; --- 406,410 ---- int result; int ret; ! ret = -1; *************** *** 412,416 **** ordered = null; while ((-1 == ret) && (lo <= hi)) ! { half = num / 2; mid = lo + ((0 != (num & 1)) ? half : half - 1); --- 412,416 ---- ordered = null; while ((-1 == ret) && (lo <= hi)) ! { half = num / 2; mid = lo + ((0 != (num & 1)) ? half : half - 1); *************** *** 420,429 **** ret = mid; else if (0 > result) ! { hi = mid - 1; num = ((0 != (num & 1)) ? half : half - 1); } else ! { lo = mid + 1; num = half; --- 420,429 ---- ret = mid; else if (0 > result) ! { hi = mid - 1; num = ((0 != (num & 1)) ? half : half - 1); } else ! { lo = mid + 1; num = half; *************** *** 461,470 **** int result; int ret; ! ret = -1; num = (hi - lo) + 1; while ((-1 == ret) && (lo <= hi)) ! { half = num / 2; mid = lo + ((0 != (num & 1)) ? half : half - 1); --- 461,470 ---- int result; int ret; ! ret = -1; num = (hi - lo) + 1; while ((-1 == ret) && (lo <= hi)) ! { half = num / 2; mid = lo + ((0 != (num & 1)) ? half : half - 1); *************** *** 473,482 **** ret = mid; else if (0 > result) ! { hi = mid - 1; num = ((0 != (num & 1)) ? half : half - 1); } else ! { lo = mid + 1; num = half; --- 473,482 ---- ret = mid; else if (0 > result) ! { hi = mid - 1; num = ((0 != (num & 1)) ? half : half - 1); } else ! { lo = mid + 1; num = half; Index: Sortable.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/util/sort/Sortable.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Sortable.java 8 Sep 2003 02:26:33 -0000 1.5 --- Sortable.java 10 Sep 2003 03:38:25 -0000 1.6 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,31 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com ! // ! // This class was contributed by // Derrick Oswald // --- 18,31 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com ! // ! // This class was contributed by // Derrick Oswald // *************** *** 60,64 **** * @param reuse If this argument is not null, it is an object * acquired from a previous fetch that is no longer needed and ! * may be returned as the result if it makes mores sense to alter * and return it than to fetch or create a new element. That is, the * reuse object is garbage and may be used to avoid allocating a new --- 60,64 ---- * @param reuse If this argument is not null, it is an object * acquired from a previous fetch that is no longer needed and ! * may be returned as the result if it makes mores sense to alter * and return it than to fetch or create a new element. That is, the * reuse object is garbage and may be used to avoid allocating a new Index: package.html =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/util/sort/package.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** package.html 8 Sep 2003 02:26:33 -0000 1.4 --- package.html 10 Sep 2003 03:38:25 -0000 1.5 *************** *** 19,23 **** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. ! You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software --- 19,23 ---- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. ! You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software *************** *** 26,38 **** For any questions or suggestions, you can write to me at : Email :so...@in... ! ! Postal Address : Somik Raha Extreme Programmer & Coach Industrial Logic Corporation ! 2583 Cedar Street, Berkeley, CA 94708, USA Website : http://www.industriallogic.com ! --> <TITLE>Sort Package</TITLE> --- 26,38 ---- For any questions or suggestions, you can write to me at : Email :so...@in... ! ! Postal Address : Somik Raha Extreme Programmer & Coach Industrial Logic Corporation ! 2583 Cedar Street, Berkeley, CA 94708, USA Website : http://www.industriallogic.com ! --> <TITLE>Sort Package</TITLE> |