Jody Garnett a écrit :
> Hi Martin; I have run into an interesting situation when comparing the 
> results of different EPSG authority factories. I cannot compare a 
> ReferenceIdentifier created with a factory against one created by hand 
> using Citations.EPSG. Citation.equals takes getVersion() into account 
> when  making the comparison.
> Currently I am doing a lot of Citation.toString() and getCode() calls in 
> order to make my comparisons.


I usually favor strict "equals" implementation in the hope to avoid arbitrary
choice or unexpected behavior, especially when the object is added in a HashSet.
In the particular case of Citation, if my memory serve me right it should not be
a problem when comparing CRS object using "equalsIgnoreMetadata"?

If the purpose is to compare Citations themself rather than CRS objects, I
suggest to keep the "equals" method strict and provide convenience methods
relaxing the comparaison in different way instead. For example should we compare
the titles or the identifiers? The Citations class provide such convenience
methods. On my side, I use Citations.identifierMatches(Citation,Citation) in
order to make my comparaisons:

http://javadoc.geotools.fr/snapshot/org/geotools/metadata/iso/citation/Citations.html#identifierMatches(org.opengis.metadata.citation.Citation,%20org.opengis.metadata.citation.Citation)

There is also a "titleMatches" method. We could add more convenience methods
making the comparaisons in different way if there is a need for that.


        Martin

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to