jdrew.oo.td.builtins
Class TDBuiltin

java.lang.Object
  extended by jdrew.oo.td.builtins.TDBuiltin
Direct Known Subclasses:
AssertBuiltin, RegisterBuiltin

public class TDBuiltin
extends java.lang.Object


Constructor Summary
TDBuiltin()
          Constructs a new empty Top-down built-in.
TDBuiltin(Builtin b)
          Constructs a new Top-Down built-in.
 
Method Summary
 DefiniteClause buildResult(BackwardReasoner.GoalList gl, int term)
          Builds the resulting fact from the call to this built-in if it exists.
 int getSymbol()
          Gets the integer symbol code for the built-in relation symbol.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TDBuiltin

public TDBuiltin()
Constructs a new empty Top-down built-in. This is provided only for compatability reasons.


TDBuiltin

public TDBuiltin(Builtin b)
Constructs a new Top-Down built-in. The user should pass an instance of the Class that implements the generic built-in relation.

Parameters:
b - Builtin A generic built-in implementation class, this must implement the jdrew.oo.builtins.Builtin Interface.
Method Detail

getSymbol

public int getSymbol()
Gets the integer symbol code for the built-in relation symbol. This method simply calls the getSymbol() method of the generic built-in implementation that is referenced by this TDBuiltin object.

Returns:
int The integer code for the built-in relation symbol

buildResult

public DefiniteClause buildResult(BackwardReasoner.GoalList gl,
                                  int term)
Builds the resulting fact from the call to this built-in if it exists. This method extracts the appropriate Term object that represents the call to the built-in relation and passes to the generic built-in's builtResult() method.

Parameters:
gl - GoalList the goal list that contains the call to the built-in
term - int The index into the atoms of the clause for the call to the built-in relation represented by this TDBuiltin object.
Returns:
DefiniteClause a DC containing a fact that will unify with the call to the built-in if it should succeed. null or a fact that will not unify (null is preferred as it is more efficient) should be returned if the call to built-in relation should not succeed.