コード例 #1
0
ファイル: Arrays.java プロジェクト: spurious/kawa-mirror
 public int effectiveIndex(int[] indexes) {
   Object obj;
   try {
     obj = proc.apply1(indexes);
   } catch (Throwable ex) {
     throw new RuntimeException("index transformer throw " + ex, ex);
   }
   if (obj instanceof int[]) return base.effectiveIndex((int[]) obj);
   IntSequence ind = Sequences.asIntSequenceOrNull(obj);
   if (ind == null) throw new ClassCastException("not an integer sequence");
   if (ind instanceof S32Vector) return base.effectiveIndex(((S32Vector) ind).getBuffer());
   else {
     int rank = ind.size();
     switch (rank) {
       case 0:
         return base.effectiveIndex();
       case 1:
         return base.effectiveIndex(ind.getInt(0));
       case 2:
         return base.effectiveIndex(ind.getInt(0), ind.getInt(1));
       default:
         int[] rest = rank == 3 ? AbstractSequence.noInts : new int[rank - 3];
         for (int i = 3; i < rank; i++) rest[i - 3] = ind.getInt(i);
         return base.effectiveIndex(ind.getInt(0), ind.getInt(1), ind.getInt(2), rest);
     }
   }
 }
 /**
  * Returns the cyc product identifier for this combination of code-product, kb-product and
  * branch-tag.
  */
 @SubL(source = "cycl/builder-utilities.lisp", position = 28769)
 public static final SubLObject find_cyc_product(
     SubLObject code_product, SubLObject kb_product, SubLObject branch_tag) {
   {
     final SubLThread thread = SubLProcess.currentSubLThread();
     return Sequences.find(
             list(code_product, kb_product, branch_tag),
             $cyc_product_definitions$.getDynamicValue(thread),
             Symbols.symbol_function(EQUAL),
             Symbols.symbol_function($sym40$CDR),
             UNPROVIDED,
             UNPROVIDED)
         .first();
   }
 }
 @SubL(source = "cycl/constant-completion.lisp", position = 2143)
 public static final SubLObject compute_bogus_constant_names_in_code() {
   {
     final SubLThread thread = SubLProcess.currentSubLThread();
     if ((NIL != $constant_names_in_code$.getGlobalValue())) {
       {
         SubLObject _prev_bind_0 =
             utilities_macros.$noting_progress_start_time$.currentBinding(thread);
         try {
           utilities_macros.$noting_progress_start_time$.bind(Time.get_universal_time(), thread);
           utilities_macros.noting_progress_preamble($str4$Computing_bogus_constant_names_in);
           $bogus_constant_names_in_code$.setGlobalValue(NIL);
           {
             SubLObject cdolist_list_var = $constant_names_in_code$.getGlobalValue();
             SubLObject name = NIL;
             for (name = cdolist_list_var.first();
                 (NIL != cdolist_list_var);
                 cdolist_list_var = cdolist_list_var.rest(), name = cdolist_list_var.first()) {
               {
                 SubLObject constant = constants_high.find_constant(name);
                 if ((NIL != constants_high.uninstalled_constant_p(constant))) {
                   $bogus_constant_names_in_code$.setGlobalValue(
                       cons(name, $bogus_constant_names_in_code$.getGlobalValue()));
                 }
               }
             }
           }
           $bogus_constant_names_in_code$.setGlobalValue(
               Sort.sort(
                   $bogus_constant_names_in_code$.getGlobalValue(),
                   Symbols.symbol_function($sym3$STRING_),
                   UNPROVIDED));
           utilities_macros.noting_progress_postamble();
         } finally {
           utilities_macros.$noting_progress_start_time$.rebind(_prev_bind_0, thread);
         }
       }
     }
     return Sequences.length($bogus_constant_names_in_code$.getGlobalValue());
   }
 }
 @SubL(source = "cycl/constant-completion.lisp", position = 1600)
 public static final SubLObject initialize_constant_names_in_code() {
   if (ZERO_INTEGER.numE(constant_handles.constant_count())) {
     $constant_names_in_code$.setGlobalValue(NIL);
     {
       SubLObject cdolist_list_var = constant_handles.invalid_constant_names();
       SubLObject invalid_constant_name = NIL;
       for (invalid_constant_name = cdolist_list_var.first();
           (NIL != cdolist_list_var);
           cdolist_list_var = cdolist_list_var.rest(),
               invalid_constant_name = cdolist_list_var.first()) {
         $constant_names_in_code$.setGlobalValue(
             cons(invalid_constant_name, $constant_names_in_code$.getGlobalValue()));
       }
     }
     $constant_names_in_code$.setGlobalValue(
         Sort.sort(
             $constant_names_in_code$.getGlobalValue(),
             Symbols.symbol_function($sym3$STRING_),
             UNPROVIDED));
   }
   return Sequences.length($constant_names_in_code$.getGlobalValue());
 }
 /**
  * Generate a KB SBHL caching policy proposal for sticky SBHL caching that for all passed link
  * predicates.
  *
  * @param WITH-PREFETCH-P determines whether the prefetch will be all or none
  * @return the policies
  */
 @SubL(source = "cycl/builder-utilities.lisp", position = 38500)
 public static final SubLObject propose_all_sticky_kb_sbhl_caching_policies(
     SubLObject link_predicates, SubLObject with_prefetch_p) {
   if ((NIL == link_predicates)) {
     link_predicates = get_all_sbhl_module_link_predicates();
   }
   {
     SubLObject prefetch = ((NIL != with_prefetch_p) ? ((SubLObject) $kw58$ALL) : NIL);
     SubLObject policies = NIL;
     SubLObject cdolist_list_var = link_predicates;
     SubLObject link_predicate = NIL;
     for (link_predicate = cdolist_list_var.first();
         (NIL != cdolist_list_var);
         cdolist_list_var = cdolist_list_var.rest(), link_predicate = cdolist_list_var.first()) {
       {
         SubLObject legacy_policy =
             sbhl_caching_policies.create_sbhl_caching_policy_from_term_recommendation_list(
                 link_predicate, $kw56$STICKY, $kw57$UNDEFINED, NIL, $kw58$ALL, prefetch);
         policies = cons(legacy_policy, policies);
       }
     }
     return Sequences.nreverse(policies);
   }
 }