I know it was ~11 months back when I said I would add ordering to this task, but without much interest in the task and the fact that I lost my work-in-progress it never happened. Either way, please find attached the second cut at adding ordering to the task. I've implemented a mergeSort so that an array of files can be sorted by a FileComparator (same method signiture as, but not implementing, the Java2 Comparator) objects. The UI is through an attribute order="none|date|name|path|length" defaulting to none.
The patch also changes .clear() calls to .removeAllElements() to be Java 1.1 complient. If you like the patch then I'll follow it up with unit tests and docs. Future work: Currently only supports each ordering in one direction - this should be extended. Had previously suggested another attribute ascending="true|false" but now have other thoughts... I'd like to be able specify ordering using like: order="path,-date,name" where the sorting is compounded together either by repeated mergesorts or by a composite comparator. The ordering functionality is fairly generic and should probably be factored out - possibly put into FileUtils and possibly the ordering attribute(s) should be made easy to plug into other tasks (DirectoryScanner and/or FileSet seem the obvious candidates) Once we move to Ant2 (and therefore Java2) we should probably drop mergeSort in favour of Collections.sort() If anybody wants to tackle any of this, feel free. Although a copy in CVS would be nicer to do diffs against (hint hint), after all, the following hardly holds true anymore :) "I think the ANT-ers are too close to releasing 1.3 to include this... oh well." - Joshua Davis Thoughts? Rob > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 20, 2001 10:15 PM > To: [EMAIL PROTECTED] > Subject: RE: concat task WAS: RE: copy task with merge mapper bug? > > > I am not sure to understand the "you are forced to externalize something". > When each file to concat are explicitly named (not through a search > pattern), we can enforce the order. > When a patternset is used, it can behave like a DOS or Unix shell will do > (like what an "ls ./*/*" will do, by width and alphabetical order), since > this what will append if I do a cat ./*/* in a Makefile or shell script. > Make sense? > > Thomas > > -----Original Message----- > From: Stephane Bailliez [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 20, 2001 5:20 AM > To: Ant Developers List > Subject: concat task WAS: RE: copy task with merge mapper bug? > > > > -----Original Message----- > > From: Stefan Bodewig [mailto:[EMAIL PROTECTED] > > [...] > > What you expecteded it to do is something that wouldn't really fit > > into my picture of a copy task, more something like a new <concat> > > task or similar. > > So, is it worth adding this task to the core ? > http://marc.theaimsgroup.com/?l=ant-dev&m=97942383311788&w=2 > > I'm still not sure how to deal with order. > As a fileset as no guarantee about order, this not so good for > many uses and > a filelist can be nice but not that flexible, as you are forced to > externalize something (using echo ?) > > I don't think we can use 'path' as I feel the semantic somewhat different > but I'm not so sure... > > Any suggestions ? > > Stephane > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> >
concat-order.patch
Description: Binary data
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
