irstv/orbisgis — pull request #245 by agueganno (2013-02-11 16:14:18+00:00)
Title: Visitor pattern

This pull request is made of three main things, all of them being related...

It provides a basis for the unique value implementation in the legend API. It's not totally complete yet, but it's a good start. This implementation stressed the usability of the analyzer part of the legend library. I foudn that it could become way simpler...

To achieve simplicity, I've decided to implement the Visitor pattern on the symbolizer tree. Consequently, I've reworked both getUsedAnalysis and dependsOnFeatures to rely on Visitors. It's, well... much cleaner ! It saves more than 1000 lines of code... And there should not be any efficiency cost.

With these visitors available, I have been able to rework analyzers for Symbolizer instances. They now work by studying the structure of SeParameters instances under the Symbolizer and by making some light pattern matching on types. The code used to analyze Symbolizer instances is now way lighter...

There's a huge part of the legend API that may not be useful anymore. Momst of the classes under org.orbisgis.legend.analyzer don't have practical use currently. I want to check that we won't need them in any way before removing them from the API. I think they may be useful in some ways for partial pattern validation. Must still think about the "how", though...

The PR is "quite" huge, I'm sorry for that. I originally wanted ot make one just for unique values, but it would have been meaningless without visitors so, well... It's huge. :-(

I've tried to write as many unit tests as possible. After all, we want to keep quality high in our software ;-)