public abstract class Term extends Object
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library Public License for more details.
| Modifier | Constructor and Description |
|---|---|
protected |
Term()
This default constructor is provided in order for subclasses
to be able to define their own default constructors.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
computeSubstitution(Hashtable bindings,
Hashtable vars)
This method computes a substitution from a Term.
|
protected static void |
computeSubstitutions(Hashtable bindings,
Hashtable vars,
Term[] arg)
Just calls computeSubstitution in each Term in the list.
|
abstract String |
debugString() |
static String |
debugString(Term[] arg) |
protected static Term[] |
from_term_t(Hashtable vars,
int n,
term_t term0)
This method calls from_term_t on each term in the consecutive list
of term_ts.
|
protected static Term |
from_term_t(Hashtable vars,
term_t term)
We do some type analysis on the term_t then forward the
call to the appropriate class
|
protected abstract void |
put(Hashtable var_table,
term_t term)
Cache the reference to the Prolog term_t here.
|
protected static boolean |
terms_equals(Term[] t1,
Term[] t2)
This method is used to determine the Terms in two Term arrays
are pairwise equal, where two Terms are equal if they satisfy
the equals predicate (defined differently in each Term subclass).
|
protected static term_t |
terms_to_term_ts(Hashtable var_table,
Term[] arg)
This static method converts an array of Terms to a *consecutive*
sequence of term_t objects.
|
static String |
toString(Term[] arg)
Converts a list of Terms to a String.
|
protected Term()
protected abstract void put(Hashtable var_table, term_t term)
var_table - A Hashtable containing term_t's that are
bound to (have been put in) Prolog variables as elements. The
Elements are keyed by jpl.Variable instances. Cf. the put()
implementation in the Variable class.term - A (previously created) term_t which is to be
put with a Prolog term-type appropriate to the Term type
(e.g., Atom, Variable, Compound, etc.) on which the method is
invoked.)protected static term_t terms_to_term_ts(Hashtable var_table, Term[] arg)
var_table - A Hashtable containing term_t's that are
bound to (have be put in in) Prolog variables as elements. The
Elements are keyed by jpl.Variable instances. Cf. the put()
implementation in the Variable class.arg - An array of jpl.Term references.protected static Term[] from_term_t(Hashtable vars, int n, term_t term0)
vars - A Hashtable containing jpl.Variable instances
as elements, indexed by their *Prolog* names, which are guaranteed
to be unique. Cf. the from_term_t method of the Variable class.n - The number of consecutive term_tsterm0 - The 0th term_t (structure); subsequent
term_ts are not structures.protected static Term from_term_t(Hashtable vars, term_t term)
vars - A Hashtable containing jpl.Variable instances
as elements, indexed by their *Prolog* names, which are guaranteed
to be unique. Cf. the from_term_t method of the Variable class.term - The term_t to convertprotected abstract void computeSubstitution(Hashtable bindings, Hashtable vars)
A second Hashtable, vars, is required; this table holds the Variables that occur (thus far) in the unified term. The Variable instances in this table are guaranteed to be unique and are keyed on Strings which are Prolog internal representations of the variables.
bingings - table holding Term substitutions, keyed on
Variables.vars - A Hashtable holding the Variables that occur
thus far in the term; keyed by internal (Prolog) string rep.protected static void computeSubstitutions(Hashtable bindings, Hashtable vars, Term[] arg)
table - table holding Term substitutions, keyed on
Variables.arg - a list of Termsprotected static boolean terms_equals(Term[] t1, Term[] t2)
t1 - an array of Termst2 - an array of Termspublic static String toString(Term[] arg)
arg - An aaray of Terms to convertpublic abstract String debugString()
Copyright © 2015. All rights reserved.