// (c) MIT 2003.  All rights reserved.

// -*-Mode: Java-*- 
// $Id: Rule.java,v 1.3 2003/03/06 00:40:39 moltmans Exp $
// Rule.java -- 
// Author: Michael Oltmans <moltmans@ai.mit.edu> 
// Created: <Sun Apr 30 21:31:14 2000> 
// Time-stamp: <2000-05-09 18:45:23 moltmans> 
package rec.tms;

import java.util.*;

/**
 * Rules have 2 parts.  The first is matching.  Second, if the rule
 * matches then the rule is run, to produce its effects.
 **/
public interface Rule 
{
  /**
   * Return a list of strings, which are the types of the triggers to
   * be matched.  This method should always return the same list of
   * types.
   **/
  public LinkedList getTriggers();

  /**
   * Check if the rule applies to the given facts under the assumption
   * that they are all true.
   *
   * This should also return true when given a subset of the params.
   * It will be called with the first param, then with the first two,
   * etc...  This is so we can avoid trying gazillions of
   * possibilities that are all not matching for the same reason.
   * This also allows means that more discriminating paramaters should
   * be listed first for efficiency.
   *
   * @param bindings List of Facts that are possible bindings
   * @return true if the rule applies to this set of inputs.
   **/
  public boolean match( LinkedList bindings );

  /**
   * @param bindings List of bindings to run the body with
   * @return true if the body actually fires on the given datum.
   **/
  public void run( JTRE jtre, LinkedList bindings );
}

