public class Compound extends Term
Term[] arg = { new Atom( "a" ) };
Compound f = new Compound( new Atom( "f" ), arg );
See the List and Tuple classes for common extensions of this class.
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 and Type | Field and Description |
|---|---|
protected Term[] |
args_
the arguments in this Compound
|
protected Atom |
atom_
the atom in this Compound
|
| Constructor and Description |
|---|
Compound(Atom atom,
Term[] args)
Creates a Comound with an Atom and an array of arguments.
|
Compound(String name,
Term t0)
This constructor is shorthand for
|
Compound(String name,
Term[] args)
This constructor is short for
|
Compound(String name,
Term t0,
Term t1)
This constructor is shorthand for
|
Compound(String name,
Term t0,
Term t1,
Term t2)
This constructor is shorthand for
|
Compound(String name,
Term t0,
Term t1,
Term t2,
Term t3)
This constructor is shorthand for
|
Compound(String name,
Term t0,
Term t1,
Term t2,
Term t3,
Term t4)
This constructor is shorthand for
|
Compound(String name,
Term t0,
Term t1,
Term t2,
Term t3,
Term t4,
Term t5)
This constructor is shorthand for
|
Compound(String name,
Term t0,
Term t1,
Term t2,
Term t3,
Term t4,
Term t5,
Term t6)
This constructor is shorthand for
|
Compound(String name,
Term t0,
Term t1,
Term t2,
Term t3,
Term t4,
Term t5,
Term t6,
Term t7)
This constructor is shorthand for
|
Compound(String name,
Term t0,
Term t1,
Term t2,
Term t3,
Term t4,
Term t5,
Term t6,
Term t7,
Term t8)
This constructor is shorthand for
|
Compound(String name,
Term t0,
Term t1,
Term t2,
Term t3,
Term t4,
Term t5,
Term t6,
Term t7,
Term t8,
Term t9)
This constructor is shorthand for
|
| Modifier and Type | Method and Description |
|---|---|
Term[] |
args() |
Atom |
atom() |
protected void |
computeSubstitution(Hashtable bindings,
Hashtable vars)
Nothing needs to be done except to pass the buck to the args.
|
String |
debugString() |
boolean |
equals(Object obj)
Two Compounds are equal if their atoms are equal and their
term arguments are equal.
|
protected static Term |
from_term_t(Hashtable vars,
term_t term)
Converts a term_t to a Compound.
|
Term |
ith(int i) |
protected void |
put(Hashtable var_table,
term_t term)
To put an Compound in a term, we create a sequence of term_t
references from the Term terms_to_term_t method, and then
use the Prolog cons_functor_v method to create a Prolog compound.
|
String |
toString()
Converts a Compound to its String form, atom( arg_1, ..., arg_n )
|
computeSubstitutions, debugString, from_term_t, terms_equals, terms_to_term_ts, toStringprotected Atom atom_
protected Term[] args_
public Compound(Atom atom, Term[] args)
atom - the Atom in this Compoundargs - the arguments in this Compoundpublic Compound(String name, Term[] args)
new Compound( new Atom( name ), arg )
name - the name for the Atom in this Compoundargs - the arguments in this Compoundpublic Compound(String name, Term t0)
new Compound(
new Atom( name ),
Util.toTermArray( t0 ) )
name - the name of the functor in this Compoundt0 - a jpl.Termpublic Compound(String name, Term t0, Term t1)
new Compound(
new Atom( name ),
Util.toTermArray( t0, t1 ) )
name - the name of the functor in this Compoundt0 - a jpl.Termt1 - a jpl.Termpublic Compound(String name, Term t0, Term t1, Term t2)
new Compound(
new Atom( name ),
Util.toTermArray( t0, t1, t2 ) )
name - the name of the functor in this Compoundt0 - a jpl.Termt1 - a jpl.Termt2 - a jpl.Termpublic Compound(String name, Term t0, Term t1, Term t2, Term t3)
new Compound(
new Atom( name ),
Util.toTermArray( t0, t1, t2, t3 ) )
name - the name of the functor in this Compoundt0 - a jpl.Termt1 - a jpl.Termt2 - a jpl.Termt3 - a jpl.Termpublic Compound(String name, Term t0, Term t1, Term t2, Term t3, Term t4)
new Compound(
new Atom( name ),
Util.toTermArray( t0, t1, t2, t3, t4 ) )
name - the name of the functor in this Compoundt0 - a jpl.Termt1 - a jpl.Termt2 - a jpl.Termt3 - a jpl.Termt4 - a jpl.Termpublic Compound(String name, Term t0, Term t1, Term t2, Term t3, Term t4, Term t5)
new Compound(
new Atom( name ),
Util.toTermArray( t0, t1, t2, t3, t4,
t5 ) )
name - the name of the functor in this Compoundt0 - a jpl.Termt1 - a jpl.Termt2 - a jpl.Termt3 - a jpl.Termt4 - a jpl.Termt5 - a jpl.Termpublic Compound(String name, Term t0, Term t1, Term t2, Term t3, Term t4, Term t5, Term t6)
new Compound(
new Atom( name ),
Util.toTermArray( t0, t1, t2, t3, t4,
t5, t6 ) )
name - the name of the functor in this Compoundt0 - a jpl.Termt1 - a jpl.Termt2 - a jpl.Termt3 - a jpl.Termt4 - a jpl.Termt5 - a jpl.Termt6 - a jpl.Termpublic Compound(String name, Term t0, Term t1, Term t2, Term t3, Term t4, Term t5, Term t6, Term t7)
new Compound(
new Atom( name ),
Util.toTermArray( t0, t1, t2, t3, t4,
t5, t6, t7 ) )
name - the name of the functor in this Compoundt0 - a jpl.Termt1 - a jpl.Termt2 - a jpl.Termt3 - a jpl.Termt4 - a jpl.Termt5 - a jpl.Termt6 - a jpl.Termt7 - a jpl.Termpublic Compound(String name, Term t0, Term t1, Term t2, Term t3, Term t4, Term t5, Term t6, Term t7, Term t8)
new Compound(
new Atom( name ),
Util.toTermArray( t0, t1, t2, t3, t4,
t5, t6, t7, t8 ) )
name - the name of the functor in this Compoundt0 - a jpl.Termt1 - a jpl.Termt2 - a jpl.Termt3 - a jpl.Termt4 - a jpl.Termt5 - a jpl.Termt6 - a jpl.Termt7 - a jpl.Termt8 - a jpl.Termpublic Compound(String name, Term t0, Term t1, Term t2, Term t3, Term t4, Term t5, Term t6, Term t7, Term t8, Term t9)
new Compound(
new Atom( name ),
Util.toTermArray( t0, t1, t2, t3, t4,
t5, t6, t7, t8, t9 ) )
name - the name of the functor in this Compoundt0 - a jpl.Termt1 - a jpl.Termt2 - a jpl.Termt3 - a jpl.Termt4 - a jpl.Termt5 - a jpl.Termt6 - a jpl.Termt7 - a jpl.Termt8 - a jpl.Termt9 - a jpl.Termpublic final Atom atom()
public final Term[] args()
public final Term ith(int i)
protected final void put(Hashtable var_table, term_t term)
put in class Termvar_table - A Hashtable containing term_t's that are
bound to (have packed 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
packed 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 from_term_t(Hashtable vars, term_t term)
We have to do a bit of type analysis to create Java objects of the right type. For example, we don't want to create just a Compound if the term_t is a list or a tuple; we want to create a List or a Tuple, accordingly.
term - The term_t to convertprotected final void computeSubstitution(Hashtable bindings, Hashtable vars)
computeSubstitution in class Termtable - table holding Term substitutions, keyed on
Variables.public String toString()
public String debugString()
debugString in class TermCopyright © 2015. All rights reserved.