Mona,

>        I actually do need Double because I need to pass this value into a
>function to be modified; double will not work for pass by reference.

An easy way to pass a double (primitive type) by reference is to make the
function accept a double[] of size 1 instead.  For example:

// Start code fragment

public static void increment(double[] passedByRef) {
    passedByRef[0]++;
}

public static void main(String[] args) {
    double[] d = new double[1];
    d[0] = 5;
    System.out.println("double value = " + d[0]);
    increment(d);
    System.out.println("double value = " + d[0]);
}

// End code fragment

>         I know you can wrap a Double in a class object and pass that into a
>function ... but I cannot believe that you cannot assign a Double directly!

If you are writing your own function, the above array method of pass by
reference solves the problem.  The only other reason you would need a Double
(or other primitive wrapper class) is to pass in a primitive type to
something that takes an Object, such as methods from general utility classes
like java.util.Vector, java.util.Hashtable and java.util.LinkedList.

Notice that none of the above examples modify the Objects passed to them.
After all, how can you modify an Object in general without knowing more
about what it is?  So, it does not seem necessary that you would ever need
to alter the value of a Double after constructing it.  If you need a Double
with a different value, you can just construct another Double.

I hope this explanation helps.  Everyone else, sorry for the
non-Java3D-related message.

Curtis

--
Curtis Rueden <[EMAIL PROTECTED]>
VisAD Programmer, SSEC Visualization Project
http://www.ssec.wisc.edu/~billh/visad.html

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to