public static Cons getTypes(Stella_Object instanceref, Keyword directorasserted) {
    { Stella_Object instance = Logic.getInstance(instanceref);
      Cons result = Stella.NIL;

      if (instance == null) {
        return (null);
      }
      if (directorasserted == LoomApi.KWD_DIRECT) {
        { LogicObject d = null;
          Cons iter000 = Logic.allDirectTypes(instance);

          for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
            d = ((LogicObject)(iter000.value));
            result = Cons.cons(d, result);
          }
        }
      }
      else if (directorasserted == LoomApi.KWD_ASSERTED) {
        { NamedDescription d = null;
          Cons iter001 = Logic.allAssertedTypes(instance);

          for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
            d = ((NamedDescription)(iter001.value));
            result = Cons.cons(d, result);
          }
        }
      }
      else {
        { NamedDescription d = null;
          Cons iter002 = Logic.allTypes(instance);

          for (;!(iter002 == Stella.NIL); iter002 = iter002.rest) {
            d = ((NamedDescription)(iter002.value));
            result = Cons.cons(d, result);
          }
        }
      }
      return (result);
    }
  }