com.svincent.moksa
Class Rule

java.lang.Object
  |
  +--com.svincent.moksa.WamObject
        |
        +--com.svincent.moksa.Rule
Direct Known Subclasses:
Builtin.BuiltinRule, CompiledRule, InterpretedRule

public abstract class Rule
extends WamObject

The abstract base class for all Rules.


Constructor Summary
Rule()
          Make a new instance of this Rule.
 
Method Summary
abstract  int getArity()
          Return the arity of this Rule (i.e.
abstract  java.lang.String getName()
          Return the name of this Rule in "atom/arity" notation.
abstract  PrologTerm getTerm(PrologFactory factory)
          Return the Prolog term corresponding to this Rule.
 Continuation invoke(Wam wam)
          Invoke this Rule.
abstract  Continuation invokeRule(Wam wam)
          Contains the code which defines what this Rule does.
 boolean isFirstAlternative()
          true iff this is the first registered alternative.
 boolean isLastAlternative()
          true iff this is the last registered alternative.
 boolean isOnlyAlternative()
          true iff this is the only registered alternative.
 void tag(java.io.PrintWriter out)
          Returns a short, human-readable String describing this Rule.
 
Methods inherited from class com.svincent.moksa.WamObject
tag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rule

public Rule()
Make a new instance of this Rule. Rules are Singletons: there is one instance of any particular Rule class.
Method Detail

getName

public abstract java.lang.String getName()
Return the name of this Rule in "atom/arity" notation.

getArity

public abstract int getArity()
Return the arity of this Rule (i.e. - the number of parameters it expects).

getTerm

public abstract PrologTerm getTerm(PrologFactory factory)
Return the Prolog term corresponding to this Rule. The term returned is invariably an instance of :-/2: this is a Rule, after all!

isOnlyAlternative

public boolean isOnlyAlternative()
true iff this is the only registered alternative.

isFirstAlternative

public boolean isFirstAlternative()
true iff this is the first registered alternative.

isLastAlternative

public boolean isLastAlternative()
true iff this is the last registered alternative.

invoke

public Continuation invoke(Wam wam)
                    throws PrologException
Invoke this Rule. Does various WAM setup, then calls invokeRule.
See Also:
invokeRule(com.svincent.moksa.Wam)

invokeRule

public abstract Continuation invokeRule(Wam wam)
                                 throws PrologException
Contains the code which defines what this Rule does. Called by invoke.
See Also:
invoke(com.svincent.moksa.Wam)

tag

public void tag(java.io.PrintWriter out)
Returns a short, human-readable String describing this Rule.
Overrides:
tag in class WamObject



This is documentation for Moksa Prolog, which can be found at http://www.svincent.com/moksa/

Copyright © 1999 Shawn P. Vincent.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.