public static int numberOfRemainingAntecedents(Iterator iterator) {
    if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(iterator), Logic.SGT_STELLA_CONS_ITERATOR)) {
      { ConsIterator iterator000 = ((ConsIterator)(iterator));

        if (iterator000.firstIterationP) {
          return (iterator000.consIteratorCursor.length());
        }
        else {
          return (iterator000.consIteratorCursor.length() - 1);
        }
      }
    }
    else {
      { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        stream000.nativeStream.print("Don't know how to handle antecedents iterator of type `" + iterator.primaryType() + "'");
        throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
  }