All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class PrologParse.Clause

java.lang.Object
   |
   +----PrologParse.Clause

public class Clause
extends Object
Class that represents a Prolog clause (with '?' or '.' at end). A Clause is represented by a single head Term, and a Vector of Terms in the body, with a punctuation mark at the end. A Clause can be constructed from the head/body/punctuation combination, or from a vector of tokens, or finally from a prolog String representation of the Clause.

See Also:
Term, PrologParser

Variable Index

 o ASSERT
For a Clause that ends in a full-stop.
 o QUERY
For a Clause that ends in a question mark The Clause should therefore also be headless.

Constructor Index

 o Clause(String)
Constructor that parses a String to construct the Clause.
 o Clause(Term, Vector, int)
Standard Constructor.
 o Clause(Vector)
Constructor that parses a vector of tokens to construct the Clause.

Method Index

 o body()
 o bodyTerms()
 o head()
 o predicateSymbol()
 o punctuation()
 o toString()

Variables

 o ASSERT
 public static final int ASSERT
For a Clause that ends in a full-stop.

 o QUERY
 public static final int QUERY
For a Clause that ends in a question mark The Clause should therefore also be headless.

Constructors

 o Clause
 public Clause(Term head,
               Vector body,
               int punctuation)
Standard Constructor. Constructs a Clause from the specified components.

Parameters:
head - The head Term of the Clause.
body - A Vector of terms in the body of the clause.
punctuation - The punctuation mark at the end of the Clause, either Clause.ASSERT or Clause.QUERY
 o Clause
 public Clause(Vector ts)
Constructor that parses a vector of tokens to construct the Clause.

Parameters:
ts - A Vector of Tokens, as produced by a PrologTokenizer.
See Also:
Token, PrologTokenizer
 o Clause
 public Clause(String clause)
Constructor that parses a String to construct the Clause.

Parameters:
clause - A string representation of the Clause.

Methods

 o toString
 public final String toString()
Returns:
a string representation of the Clause.
Overrides:
toString in class Object
 o head
 public final Term head()
Returns:
the head of the clause
 o predicateSymbol
 public final String predicateSymbol()
Returns:
the predicate symbol for this Clause.
 o body
 public final Vector body()
Returns:
the body of this clause.
 o bodyTerms
 public final Enumeration bodyTerms()
Returns:
an enumeration of the Terms in the body of this clause.
 o punctuation
 public final int punctuation()
Returns:
the punctuation at the end of this clause.

All Packages  Class Hierarchy  This Package  Previous  Next  Index