package prolog.model;

import java.util.*;
import prolog.util.ParameterMatchingError;

/**
 * IFactList is the base interface for a collection of relations. It can
 * be compared with a database table containing rows of relations.
 * The name of the factlist would be the tablename. That's why
 * factlist extends IFact. So it inherits a name. The relation of the
 * extended IFact are also used for factlists returned by queries.
 * In this relation, parameters of the statements are stored.</p>
 * <p>prolog:</p>
 * <p>myFact(joe,dan).</p>
 * <p>myFact(joe,dan2).</p>
 * <p>In this example, the two facts "myFact" are stored in
 * a factlist.</p>
 * <p>interpreter internal:</p>
 * <p>myFact(joe,dan).</p>
 * <p>myFact(joe,dan2).</p>
 * <p>myStatement(X,Y):-myFact(X,Y).</p>
 * <p>In this example, the results returned by myFact(X,Y) are stored in a factlist.</p>
 * <p>Copyright: Copyright (c) 2002</p>
 * <p>Organisation: </p>
 */
public interface IFactList
	extends
		IFact
{
	/**
	 * @return the number of atoms stored in a relation in this factlist
	 */
	public int getColCount();

	/**
	 * @return the number of relations in this factlist
	 */
	public int getRowCount();

	/**
	 * adds a relation to this fact list
	 * @param atoms to be added
	 */
	public void addRelation( IRelation atoms );

	/**
	 * @return a iterator over all relations
	 */
	public Iterator getRelations();

	/**
	 * sets the relation
	 */
	public void setRelation( IRelation r );

	/**
	 * @param fact the search pattern
	 * @return a collection of all relations matching
	 * the found relation in the given fact
	 */
	public IFactList getMatchings( IFact fact )
		throws ParameterMatchingError;

	/**
	 * @return a copy of this fact list
	 */
	public IFactList getCopy();
}
