package prolog.model;

import java.io.*;
import prolog.*;

/**
 * <p>this is the base interface for a relation with a name.</p>
 * <p>prolog:  myFact(dan,joe).</p>
 * <p>in this example, "myFact" is the name and the parameters "dan" and "joe"
 * are the atoms in the relation.</p>
 */
public interface IFact
{
	/**
	 * returns the relalation this fact owns
	 * @return relation this fact owns
	 */
	public IRelation getRelation();

	/**
	 * returns the name of this fact
	 * @return the name of this fact
	 */
	public int getName();

	/**
	 * returns a string representation of this oject,
	 * if the parameter ISymbolTable is specified,
	 * the symbols are decoded
	 * @param table is the ISymbolTable required to decode the output
	 * @return a string representation of this oject
	 */
	public String toString( ISymbolTable table );

	/**
	 * generates xml describing this object
	 * @param out the writer to append the xml
	 * @param table the symboltable to decode the symbols
	 * @throws IOException
	 */
	public void genXml( Writer out, ISymbolTable table )
	   throws IOException;
}
