Andrew,
>Date: Wed, 01 Aug 2001 17:50:11 +0800
>From: Andrew Donaldson <abcd@xxxxxxxxxx>
>To: visad-list <visad-list@xxxxxxxxxxxxx>
>Subject: DefaultFamily and comparing RealTypes
The above message contained the following:
> Hi Bill and others,
>
> I've been comparing RealTypes a bit, and it has just stopped working.
> I'm assuming that it's ok to use == on RealTypes as they seem to be
> a global sort of thing. I am interested in testing the equality
> of the name and units etc, so I'm not using RealType.equals().
>
> The problem is that the comparison's behaviour changes after
> I create a DefaultFamily.
>
> The code below shows this (at least for me!), remove the commented
> out line to change what it prints.
>
> Is my assumption bad, or is DefaultFamily doing something bad?
While I don't know the specifics of this situation, in general, unless
it's explicitly documented that instances of a class support use of the
"==" operator, it's best not to rely on that operator when testing for
equality. Besides the "equals" method, the RealType class also has
"equalsExceptName" and "equalsExceptNameButUnits".
Do you need another comparison method?
Regards,
Steve Emmerson <http://www.unidata.ucar.edu>