Exemplo n.º 1
0
 /*
  * Put a DiscreteFunction into the BucketTree beyond the current
  * active_bucket. If was_first_variable_cancelled_by_evidence is true,
  * then mark the bucket accordingly.
  */
 private void insert(DiscreteFunction df, boolean was_first_variable_cancelled_by_evidence) {
   int i, index;
   Bucket b;
   for (i = active_bucket; i < bucket_tree.length; i++) {
     index = bucket_tree[i].variable.get_index();
     if (df.memberOf(index)) {
       bucket_tree[i].discrete_functions.addElement(df);
       // If the function is a ProbabilityFunction, store its
       // first variable appropriately (assuming for now that
       // the first variable is the only possible non-conditioning variable).
       if ((df instanceof ProbabilityFunction) && (!was_first_variable_cancelled_by_evidence)) {
         bucket_tree[i].non_conditioning_variables.addElement(df.get_variable(0));
       }
       return;
     }
   }
 }