L
Luc The Perverse
There are two parts to this question. The first is directly Java related,
the second is an algorithm issue.
I would like to use the built in quicksort functionality, but have different
input parameters that can be used to sort it. Am I going to require a
derived class for each and every sort criterion? In this particular
instance I would like to be able to sort by path, file name, size, extension
and checksum. Is the "correct" answer to write my own quicksort function
which takes a parameter detailing which item is being sorted?
Second, I would like to store sorted lists of all the files, presorted by
each criterion in arrays. What is the best method to "link" these together?
It feels like an OOP violation to put the intelligence of an outside
container in the object. Should I use a container class with an array of
indices to each of the sorted items?
the second is an algorithm issue.
I would like to use the built in quicksort functionality, but have different
input parameters that can be used to sort it. Am I going to require a
derived class for each and every sort criterion? In this particular
instance I would like to be able to sort by path, file name, size, extension
and checksum. Is the "correct" answer to write my own quicksort function
which takes a parameter detailing which item is being sorted?
Second, I would like to store sorted lists of all the files, presorted by
each criterion in arrays. What is the best method to "link" these together?
It feels like an OOP violation to put the intelligence of an outside
container in the object. Should I use a container class with an array of
indices to each of the sorted items?