This essay does not describe an existing computer program, just one that should exist. This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have prepared to help you is right here.
This project outline is not like the artificial, tidy little problems you are spoon-fed in school, when all the facts you need are included, nothing extraneous is mentioned, the answer is fully specified, along with hints to nudge you toward a single expected canonical solution. This project is much more like the real world of messy problems where it is up to you to fully the define the end point, or a series of ever more difficult versions of this project, and research the information yourself to solve them.
Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; or give you any additional materials. I have too many other projects of my own.
Though I am a programmer by profession, I don’t do people’s homework for them. That just robs them of an education.
You have my full permission to implement this project in any way you please and to keep all the profits from your endeavour.
Please do not email me about this project without reading the disclaimer above.This is one of the amanuensis projects. When you want to sort an array or Vector you need to write a collating routine that sorts by major key, then if there is a tie, it looks at the next key etc. It is quite a bit of error-prone work to write a set of comparator routines, about three lines of code per field. We need a way to generate them on the fly, just from a list of field names and an ascending/descending boolean for each field.
See SORT for some sample Java Comparator code that you might like to generate. Ideally, you would generate byte codes, which could then be interpreted or JITed. Sorts spend a considerable amount of time in the compare routines. This technique would be much faster than any general purpose compare routine that determines the major and minor keys every time it compares.
You feed in the field names, their types, and whether you want ascending or descending on each field and it stomps out the Java source for the corresponding Comparator or Comparable This source then has to be compiled before use.
Ideally you should generate the byte codes directly, then the file would not need compilation. You could crank the Comparators out dynamically while the program was running based on any fields in any combination you desired.
To do that you need reflection to discover the types and field names. Unfortunately private field names are not accesesible to the inner class you might generate. You would have to limit sort fields to non-private fields or accessor methods.
I have already implemented a simple version this project without reflection. You can see the Applet and the source code for ComparatorCutter.
This page is posted
Optional Replicator mirror
Your face IP:[22.214.171.124]
You are visitor number|