ComparatorCutter 1.4 build: 9330 released: 2009-05-22 Generates Comparator and Comparable Java code. Copyright (c) 2009 Canadian Mind Products. Java Applet (that can also be run as an application). Download from http://mindprod.com/products1.html#COMPARATORCUTTER ===> Free <=== Full source included. You may even include the source code, modified or unmodified in commercial programs that you write and distribute. May be used freely for any purpose but military. For more details on this restriction, see http://mindprod.com/contact/nonmil.html If you include any Canadian Mind Products code in your own applications, your app too must be labeled non-military use only. All Java jars and source code are included. ---- Prerequisites: This program runs under any OS, (e.g. Win2K/XP/Vista/OSX/Linux/Solaris/Vista64/AIX...) so long as you have <><> Java version 1.5 <><> or later installed. See http://mindprod.com/jgloss/installingjava.html for details. ---- Installing on a PC: Download source and compiled class files to run on your own machine as an application or Applet First install a recent Java JDK or JVM. See http://mindprod.com/jgloss/installingjava.html. To install, extract the zip download with WinZip (or similar unzip utility) into any directory you please, often J:\ -- ticking off the "use folder names" option. To run as an application,type: java -jar J:\com\mindprod\comparatorcutter\comparatorcutter.jar parms adjusting as necessary to account for where the jar file is. ---- Installing on a MacIntosh: Use Safari to download source and compiled class files to run on your own machine as an application or Applet. Safari will automatically unpack the zip into ~/Downloads (version 10.5) [or on the Desktop (version 10.4 and earlier)]. First install a recent Java JDK or JVM. See http://mindprod.com/jgloss/installingjava.html. You may optionally move the download tree to a permanent home. I don't have a MacIntosh, just a PC, so I can't test my Java programs for Mac compatibility. In theory they should work without problems, but in practice that does not always happen. If you have problems please, let me know, preferably with screenshots and complete verbatim error messages. To run as an application, without parameters, just double click the jar file. To run as an application with parameters, in bash shell type: open Terminal.app cd ~/Desktop java -jar com/mindprod/comparatorcutter/comparatorcutter.jar parms adjusting as necessary to account for where the jar file is. ---- Rebuilding: The zip already contains the necessary class and jar files, so unless you modify the program, there is no need to recompile the source or rebuild the jar. Configure basedir="E:/" in rebuild.xml to the drive where your files are. Use ANT and rebuild.xml, not build.xml, to recompile and recreate the jar. ---- Use: Comparator Cutter is an Applet that generates generates custom Java code to implemet Comparable/Comparator. The Applet lets lets you provide a few facts about the Comparable or Comparator you want and the ComparatorCutter generates you well-commented Java source code to include in your own programs. It ask you the name of the Comparator class, the name of the class of objects you are comparing, the names and types of the fields to sort/compare the objects, and whether you want ascending/descending order for each sort. You can also select whether you want to use JDK 1.5+ generics or not. You can alse select whether you want code generated that will stand-alone it its own top level class or nested in another class as a static class. ComparatorCutter runs either as an application or as an Applet that needs to run in JDK 1 6+ capable browser. Source code and sample HTML included. You can run it online at http://mindprod.com/applet/comparatorcutter.html without installing it. ---- Version History: 1.0 2009-04-22 - work started 1.1 2009-04-28 - initial public release 1.2 2009-04-28 - move to JDK 1.5 from 1.6 1.3 2009-05-21 - refactor to use enum, and permit generics and nested vs top-level Comparators 1.4 2009-05-22 - miscellaneous polishing based on experience using the cutter to regenerated many Comparators/Comparables. -30-