Made all bundles require a Java 1.4 EE, and backported some classescode to Java 1.4
[phpeclipse.git] / net.sourceforge.phpeclipse.debug.core / src / net / sourceforge / phpdt / internal / debug / core / model / PHPStackFrame.java
index dfac692..245dc76 100644 (file)
@@ -608,18 +608,20 @@ public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Compa
         * @return
         * <ul>
         * <li> -1 if the index of this stackframe is less.
-        * <li> 0 if the index of both stackfream is equal (should no happen).
-        * <li> 1 if the index of this stackfram is greater.
+        * <li> 0 if the index of both stackframes are equal (should no happen).
+        * <li> 1 if the index of this stackframe is greater.
         * </ul>
         */
        public int compareTo(Object obj) {
-               //if (index < ((PHPStackFrame) obj).getIndex()) {
-               //      return -1;
-               //} else if (index > ((PHPStackFrame) obj).getIndex()) {
-               //      return 1;
-               //}
-
-               //return 0;
-               return Integer.signum(index - ((PHPStackFrame) obj).getIndex());
+               if (!(obj instanceof PHPStackFrame)) {
+                       throw new IllegalArgumentException("A PHPStackFrame can only be compared with another PHPStackFrame");
+               }
+               int frameIndex = ((PHPStackFrame) obj).getIndex();
+               if (index < frameIndex) {
+                       return -1;
+               } else if (index > frameIndex) {
+                       return 1;
+               }
+               return 0;
        }
 }