Don,
Haven't used it, but did you try the following:
public int compareTo( Object obj )
{
return ((DataChunk3D) obj).recursion - recursion;
}
I'm thinking that the Comparable implementation requires the method
"compartTo( Object )" not "compareTo( DataChunk3D) as you have supplied.
HTH,
-Gary
"Don Casteel" <[EMAIL PROTECTED]> on 03/11/99 01:04:18 PM
To: [EMAIL PROTECTED]
cc: (bcc: Gary Moss/arl)
Subject: [java3d] Arrays, Sorting, Comparable, & compareTo()
Can someone please provide some hints on sorting Arrays?
I've implemented Comparable in my class, and attempted to set up the
compareTo() method. But I'm getting compiler errors telling me I don't have
it. This doesn't surprise me because the specification isn't at all clear
on how this is suppose to be done.
My class "DataChunk3D" creates recursive arrays composed of smaller
versions. The class works fine, and supports multiple levels of recursion,
but now I want to sort it, and can't figure out how.
Here's the "compareTo()" method I've got: (with no idea of what
I'm doing)
public int compareTo(DataChunk3D dc3d)
{
return dc3d.recursion-recursion;
};
And here's the compiler error I'm getting:
.\DataChunk3D.java:14: class DataChunk3D must be declared abstract. It does
not define int compareTo
(java.lang.Object) from interface java.lang.Comparable.
public class DataChunk3D extends Applet implements Comparable
^
Don Casteel
Manufacturing Engineer
TEXTRON Automotive Company -- Athens Operations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Voice: (423)744-1109
Fax: (423)744-1112
Pager: (423)744-1129 -- 109
Internet: [EMAIL PROTECTED]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/