All Packages Class Hierarchy This Package Previous Next Index
Class JavaAgent.resource.fopl.FunctTerm
java.lang.Object
|
+----JavaAgent.resource.fopl.Term
|
+----JavaAgent.resource.fopl.FunctTerm
- public class FunctTerm
- extends Term
This class allows to build structured Terms that consist of a function
symbol and a number of arguments. There must be at least one argument,
otherwise this FunctTerm is a ConstTerm and should be represented
as such.
- See Also:
- ConstTerm
-
FunctTerm(Symbol, Vector)
- This constructor for a FunctTerm takes a Symbol (the function symbol)
and a Vector of arguments.
-
allSubTerms()
- This function returns an Enumeration over all sub-terms in this FunctTerm.
-
arguments()
- This function returns an Enumeration over the arguments of this
FunctTerm.
-
clone()
-
Returns a copy of this FunctTerm.
-
clone(Substitution)
-
Returns a copy of this FunctTerm with Variables replaced according to
the given Substitution.
-
clone(Substitution, Term, Term)
-
Returns a copy of this FunctTerm with Variables replaced according to
the given Substitution and the first Term replaced by the second.
-
contains(Vector, Substitution, Vector)
- This function tests whether one of the Variables in the given set of
variables occurs in this FunctTerm taking the given Substitution into
account.
-
equals(Object)
-
A FunctTerm is equal to any other FunctTerm that consists
of an equal function symbol followed by an equal number of equal Terms.
-
getVars(Vector)
- This function adds the Variables in this FunctTerm to the given Vector.
-
toString()
- A FunctTerm is printed as ( <constant> <term>+ )
-
unify(Term, Substitution)
- This function attempts to extend the given Substitution so that this
FunctTerm and the given Term are unified.
FunctTerm
public FunctTerm(Symbol aSy,
Vector someTerms) throws IllegalArgumentException
- This constructor for a FunctTerm takes a Symbol (the function symbol)
and a Vector of arguments. All elements of the Vector must be Terms!
- Parameters:
- aSy - the function symbol
- someTerms - the Vector of argument terms
- Throws: IllegalArgumentException
- An exception will occur if the
given Symbol is null, the given Vector is null or empty, or one of the
elements of the Vector is not a Term.
clone
public Object clone()
- Returns a copy of this FunctTerm. Variables and Symbols in the
copy will be the same as the original ones. The function uses
clone() again to generate the copies of all the agrument
Terms in this FunctTerm.
- Returns:
- an equal copy of this FunctTerm
- Overrides:
- clone in class Term
clone
public Term clone(Substitution s) throws IllegalArgumentException
- Returns a copy of this FunctTerm with Variables replaced according to
the given Substitution. Symbols in the copy will be the same
as the original ones but Variables will be repalced by the respective
Terms in the given Substitution. A Variable not occurring in the
Substitution will be replaced by a new (different) Variable with the
same name. The given Substitution will be extended to include the
mappings of old Variables to new ones.
This function can also be used to generate a copy of this
FunctTerm that contains a new set of Variables. The given Substitution
should be a new, empty Substitution in this case. Otherwise cloning
can be seen as instantiating this FunctTerm.
- Parameters:
- s - the Substitution that tells us how to replace Variables
- Returns:
- a new FunctTerm that is an instance of this FunctTerm; the
Substitution s will extended with any new Variable
replacements introduced
- Throws: IllegalArgumentException
- An exception can occur if the given
Substitution is null. In this case clone() (above) should be
used.
- Overrides:
- clone in class Term
clone
protected Term clone(Substitution s,
Term t,
Term rTerm) throws IllegalArgumentException
- Returns a copy of this FunctTerm with Variables replaced according to
the given Substitution and the first Term replaced by the second. Apart
from the Term replacement this function is just like
clone(Substitution) above. However if this is the first given
then an instance of the second given Term under the given Substitution
will be returned.
- Parameters:
- s - the Substitution that tells us how to replace Variables
- t - the sub-Term to be replaced
- rTerm - the (uninstantiated) replacement Term
- Returns:
- a new Term that is, apart from the replaced Term, an instance
of this Term; the Substitution s will extended with any new
Variable replacements introduced
- Throws: IllegalArgumentException
- An exception can occur if the given
Substitution is null.
- Overrides:
- clone in class Term
getVars
public void getVars(Vector vars) throws IllegalArgumentException
- This function adds the Variables in this FunctTerm to the given Vector. No
Variable is added twice though.
- Parameters:
- vars - a Vector of Variables that will be extended
- Throws: IllegalArgumentException
- An exception can occur if the given
Vector is null.
- Overrides:
- getVars in class Term
unify
public boolean unify(Term other,
Substitution s) throws IllegalArgumentException, UnificationException
- This function attempts to extend the given Substitution so that this
FunctTerm and the given Term are unified. It returns true if
and only if this is possible. If the other Term is a FunctTerm then
unification succeeds only if the two function symbols are equal and the
Substitution can be extended to unify all arguments. If
the other Term is a VarTerm then unification succeeds only if the
given Substitution can be extended accordingly.
- Parameters:
- other - the other Term this FunctTerm is to be unified with
- s - the Substitution to be extended for the unification
- Returns:
- whether a unifying extension of the given Substitution was
possible
- Throws: IllegalArgumentException
- An exception will occur if the given
Term or the given Substitution are null.
- Throws: UnificationException
- An exception will occur if the given
Substitution was already finshed.
- Overrides:
- unify in class Term
contains
protected boolean contains(Vector theVars,
Substitution s,
Vector okVars)
- This function tests whether one of the Variables in the given set of
variables occurs in this FunctTerm taking the given Substitution into
account.
- Parameters:
- theVars - the Variables to be tested whether they occur in this
FunctTerm
- s - the Substitution under which the test takes place
- Returns:
- true if and only if a Variable in the given Vector is
contained in this FunctTerm under the given Substitution
- Overrides:
- contains in class Term
arguments
public Enumeration arguments()
- This function returns an Enumeration over the arguments of this
FunctTerm.
- Returns:
- an Enumeration over the arguments of this FunctTerm
allSubTerms
public Enumeration allSubTerms()
- This function returns an Enumeration over all sub-terms in this FunctTerm.
Note that this is not an Enumeration over the arguments but every
sub-Term within this FunctTerm.
- Returns:
- an Enumeration over all sub-Terms in this FunctTerm
toString
public String toString()
- A FunctTerm is printed as ( <constant> <term>+ )
- Returns:
- the String that represents this FunctTerm
- Overrides:
- toString in class Object
equals
public boolean equals(Object otherTerm)
- A FunctTerm is equal to any other FunctTerm that consists
of an equal function symbol followed by an equal number of equal Terms.
- Parameters:
- otherTerm - the Object this FunctTerm is compared to
- Returns:
- whether the given Object equals this FunctTerm
- Overrides:
- equals in class Term
All Packages Class Hierarchy This Package Previous Next Index