DataImpl Arithmetic
Eric Davies
Eric at barrodale.com
Fri May 26 11:34:28 MDT 2006
Just a thought for the future:
Why isn't the error that Kevin experienced a compile time error
instead of a runtime error?
At a high level, this is a type mismatch error and Java is a very
strongly typed language, suggesting that its compile time type
checking system should be usable to enforce such.
Using interfaces to clarify input arguments would serve as automatic
documentation as to what the input arguments were actually allowed to be.
Possible?
At 09:57 AM 26/05/2006, Bill Hibbard wrote:
>Hi Kevin,
>
>You cannot do arithmetic with Sets, as they are assumed to
>play the role of function domains and arithmetic operations
>apply to function ranges or simple Reals or Tuples.
>
>You can apply binary operations to Data objects with the
>same type, to a Data object other than a Set and a constant,
>and to a function object and a Data object whose type is the
>same as the function range type. And you can apply the binary
>operation of addition (and only addition) to two Text objects.
>
>Note that in this context when we say types are equal, we
>mean in the sense that any two RealTypes are equal.
>
>Good luck,
>Bill
>
> > What are the rules regarding arithmetic with DataImpls? Do they need to
> > be of the same type?
> >
> > I.e., can I only do FlatField ff = (FlatField) old_ff.multiply(other_ff)
> >
> > I'm having some trouble creating (essentially scaling) a set by a constant.
> >
> > I'm trying the following:
> >
> > Linear1DSet alt_set = new Linear1DSet(altitude,
> > alt_map.getRange()[0],
> > alt_map.getRange()[1],
> > 100);
> >
> > Linear1DSet refr_set = (Linear1DSet)alt_set.multiply( new
> > Real((4.0/3.0)*CURVE) );
> >
> > And I get a runtime error at the above line that reads:
> >
> > Exception in thread "main" visad.UnimplementedException: SetType.binary
> >
> > Thanks for your help with this trivial problem!
>
>==============================================================================
>To unsubscribe visad, visit:
>http://www.unidata.ucar.edu/mailing-list-delete-form.html
>==============================================================================
**********************************************
Eric Davies, M.Sc.
Barrodale Computing Services Ltd.
Tel: (250) 472-4372 Fax: (250) 472-4373
Web: http://www.barrodale.com
Email: eric at barrodale.com
**********************************************
Mailing Address:
P.O. Box 3075 STN CSC
Victoria BC Canada V8W 3W2
Shipping Address:
Hut R, McKenzie Avenue
University of Victoria
Victoria BC Canada V8W 3W2
**********************************************
More information about the visad
mailing list