poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Schmid, Robert D." <rsch...@swri.org>
Subject Sorting
Date Wed, 11 Feb 2009 17:05:41 GMT
I am facing a situation where I need to sort an excel file.  After much
searching I determined that the functionality is not there.

So I opened the source and began to poke around.  After reading the
source I have come to the conclusion that it has been deliberately
written to make sorting impossible.  

In the HSSFSheet, rows are stored as a TreeMap - an inherently sortable
map but the rows use themselves as keys.  The HSSFRow implements
comparable but uses its own row numbers as the comparison value.

I could easily extend these classes for sorting IF

The rows TreeMap was accessible outside the class.  It is not.
I could extend HSSFRow and override the compareTo method but HSSFRow is
'final'.

So, why is it implemented this way?  Are there some advantages to this
implementation that make it worth blocking out the inherent sort
features of a TreeMap?

Robert Schmid
Senior Research Scientist
Southwest Research Institute
(210) 522-2909



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message