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
-
ASSERT
- For a Clause that ends in a full-stop.
-
QUERY
- For a Clause that ends in a question mark
The Clause should therefore also be headless.
-
Clause(String)
- Constructor that parses a String to construct the Clause.
-
Clause(Term, Vector, int)
- Standard Constructor.
-
Clause(Vector)
-
Constructor that parses a vector of tokens to construct the Clause.
-
body()
-
-
bodyTerms()
-
-
head()
-
-
predicateSymbol()
-
-
punctuation()
-
-
toString()
-
ASSERT
public static final int ASSERT
- For a Clause that ends in a full-stop.
QUERY
public static final int QUERY
- For a Clause that ends in a question mark
The Clause should therefore also be headless.
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
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
Clause
public Clause(String clause)
- Constructor that parses a String to construct the Clause.
- Parameters:
- clause - A string representation of the Clause.
toString
public final String toString()
- Returns:
- a string representation of the Clause.
- Overrides:
- toString in class Object
head
public final Term head()
- Returns:
- the head of the clause
predicateSymbol
public final String predicateSymbol()
- Returns:
- the predicate symbol for this Clause.
body
public final Vector body()
- Returns:
- the body of this clause.
bodyTerms
public final Enumeration bodyTerms()
- Returns:
- an enumeration of the Terms in the body of this clause.
punctuation
public final int punctuation()
- Returns:
- the punctuation at the end of this clause.
All Packages Class Hierarchy This Package Previous Next Index