public static java.lang.reflect.Method chooseSortPredicate(Stella_Object firstelement) {
    if (firstelement == null) {
      return (null);
    }
    { Surrogate testValue000 = Stella_Object.safePrimaryType(firstelement);

      if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_GENERALIZED_SYMBOL)) {
        { GeneralizedSymbol firstelement000 = ((GeneralizedSymbol)(firstelement));

          return (Native.find_java_method("edu.isi.stella.GeneralizedSymbol", "generalizedSymbolLessThanP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.GeneralizedSymbol"), Native.find_java_class("edu.isi.stella.GeneralizedSymbol")}));
        }
      }
      else if (Surrogate.subtypeOfIntegerP(testValue000)) {
        { IntegerWrapper firstelement000 = ((IntegerWrapper)(firstelement));

          return (Native.find_java_method("edu.isi.stella.IntegerWrapper", "wrappedIntegerLessThanP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.IntegerWrapper"), Native.find_java_class("edu.isi.stella.IntegerWrapper")}));
        }
      }
      else if (Surrogate.subtypeOfLongIntegerP(testValue000)) {
        { LongIntegerWrapper firstelement000 = ((LongIntegerWrapper)(firstelement));

          return (Native.find_java_method("edu.isi.stella.LongIntegerWrapper", "wrappedLongIntegerLessThanP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.LongIntegerWrapper"), Native.find_java_class("edu.isi.stella.LongIntegerWrapper")}));
        }
      }
      else if (Surrogate.subtypeOfFloatP(testValue000)) {
        { FloatWrapper firstelement000 = ((FloatWrapper)(firstelement));

          return (Native.find_java_method("edu.isi.stella.FloatWrapper", "wrappedFloatLessThanP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.FloatWrapper"), Native.find_java_class("edu.isi.stella.FloatWrapper")}));
        }
      }
      else if (Surrogate.subtypeOfStringP(testValue000)) {
        { StringWrapper firstelement000 = ((StringWrapper)(firstelement));

          return (Native.find_java_method("edu.isi.stella.StringWrapper", "wrappedStringLessThanP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.StringWrapper"), Native.find_java_class("edu.isi.stella.StringWrapper")}));
        }
      }
      else if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_MUTABLE_STRING_WRAPPER)) {
        { MutableStringWrapper firstelement000 = ((MutableStringWrapper)(firstelement));

          return (Native.find_java_method("edu.isi.stella.MutableStringWrapper", "wrappedMutableStringLessThanP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.MutableStringWrapper"), Native.find_java_class("edu.isi.stella.MutableStringWrapper")}));
        }
      }
      else {
        { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

          stream000.nativeStream.print("choose-sort-predicate: Don't know how to sort `" + firstelement.primaryType() + "'s");
          throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
        }
      }
    }
  }