Re: DisplayRealType ClassCastException

Hi Doug,

> Why is it that these work:
> 
> ScalarType type = (ScalarType) ScalarType.getScalarTypeByName("XAxis");
> RealType type   = (RealType)   ScalarType.getScalarTypeByName("XAxis");
> 
> but 
> 
> DisplayRealType type = (DisplayRealType)
> ScalarType.getScalarTypeByName("XAxis");
> 
> gives:
> 
> java.lang.ClassCastException: visad.RealType
> 
> Is this a bug or a feature?

A feature.  DisplayRealType extends RealType but the DisplayRealType
constructor prepends "Display" to the name String before invoking
the RealType super constructor.  To avoid confusion, of course ;)

So:

    DisplayRealType type = (DisplayRealType)
      ScalarType.getScalarTypeByName("DisplayXAxis");

works.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html