    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class JavaAgent.resource.fopl.ConstTerm

    java.lang.Object
       |
       +----JavaAgent.resource.fopl.Term
               |
               +----JavaAgent.resource.fopl.ConstTerm

public class ConstTerm
extends Term

The most basic Term is a ConstTerm that is represented by a Symbol. ConstTerms or constants are usually used in logic to represent named individuals or concepts.

See Also:
  Symbol

##

ConstTerm(String)
  This constructor takes a String that is interpreted as the name of a Symbol.
ConstTerm(Symbol)
  This constructor just takes the Symbol that is this Term.

##

clone()
  Cloning a ConstTerm returns another ConstTerm that contains the same Symbol.
clone(Substitution)
  Cloning a ConstTerm under a given Substitution returns another ConstTerm that contains the same Symbol.
clone(Substitution, Term, Term)
  Cloning a ConstTerm under a given Substitution returns another ConstTerm that contains the same Symbol or an instance of the second given Term if this is the first given Term.
contains(Vector, Substitution)
  This function tests whether one of the Variables in the given set of variables occurs in this Term taking the given Substitution into account.
contains(Vector, Substitution, Vector)
  Like `contains(Vector, Substitution)`, this function tests whether one of the variables in the first given Vector occurs in this Term taking the given substitution into account.
equals(Object)
  A ConstTerm is equal to any other ConstTerm that holds the same Symbol.
getSymbol()
  This function can be used to extract the Symbol contained in this ConstTerm.
getVars(Vector)
  This function adds the Variables in this Term to the given Vector.
toString()
  A ConstTerm is printed as the Symbol it holds.
unify(Term, Substitution)
  This function attempts to extend the given Substitution so that this Term and the given Term are unified.

##

ConstTerm

     public ConstTerm(Symbol aSy) throws IllegalArgumentException

  This constructor just takes the Symbol that is this Term. Note that there is only one Symbol (in memory) with this name, but there may well be several ConstTerms containing this Symbol.

  Parameters:
    aSy - the Symbol that is this Term
  Throws: IllegalArgumentException
    An exception will occur if the given Symbol is null.

ConstTerm

     public ConstTerm(String aName) throws IllegalArgumentException

  This constructor takes a String that is interpreted as the name of a Symbol. This constructor will not check whether the given name is a legal Symbol name (e.g. does not contain spaces).

  Parameters:
    aName - the name of the Symbol that is this Term
  Throws: IllegalArgumentException
    An exception will occur if the supplied String is empty or null.

##

clone

     public Object clone()

  Cloning a ConstTerm returns another ConstTerm that contains the same Symbol.

  Returns:
    a new ConstTerm containing the same Symbol
  Overrides:
    clone in class Term

clone

     public Term clone(Substitution s)

  Cloning a ConstTerm under a given Substitution returns another ConstTerm that contains the same Symbol. Since a ConstTerm cannot contain Variables the Substitution will be ignored.

  Parameters:
    s - a Substitution (will be ignored)
  Returns:
    a new ConstTerm containing the same Symbol
  Overrides:
    clone in class Term

clone

     protected Term clone(Substitution s,
                          Term t,
                          Term rTerm) throws IllegalArgumentException

  Cloning a ConstTerm under a given Substitution returns another ConstTerm that contains the same Symbol or an instance of the second given Term if this is the first given Term.

  Parameters:
    s - a Substitution
    t - the Term to be replaced
    rTerm - the (uninstantiated) replacement Term
  Returns:
    a new ConstTerm containing the same Symbol or an instance of rTerm if this Term is the given Term t
  Overrides:
    clone in class Term

getVars

     public void getVars(Vector vars)

  This function adds the Variables in this Term to the given Vector. However, as ConstTerms do not contain Variables this function effectively does nothing.

  Parameters:
    vars - a Vector of Variables (will be ignored)
  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 Term and the given Term are unified. It returns `true` if and only if this is possible. If the other Term is a ConstTerm then unification succeeds only if the two contained Symbols are equal. 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 ConstTerm 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

     public boolean contains(Vector theVars,
                             Substitution s)

  This function tests whether one of the Variables in the given set of variables occurs in this Term taking the given Substitution into account. Since ConstTerms don't contain any Variables this is always false and this function effectively does nothing.

  Parameters:
    theVars - the Variables to be tested whether they occur in this Term (will be ignored)
    s - the Substitution under which the test takes place (will be ignored)
  Returns:
    `false`
  Overrides:
    contains in class Term

contains

     protected boolean contains(Vector theVars,
                                Substitution s,
                                Vector okVars)

  Like `contains(Vector, Substitution)`, this function tests whether one of the variables in the first given Vector occurs in this Term taking the given substitution into account. Normally, the public version of `contains` (above) should be used. For ConstTerms the effect is identical though, i.e. there is no effect.

  Parameters:
    theVars - the Variables to be tested whether they occur in this Term (will be ignored)
    s - the Substitution under which the test takes place (will be ignored)
    okVars - some Variables in this Term that have already been tested (will be ignored)
  Returns:
    `false`
  Overrides:
    contains in class Term

toString

     public String toString()

  A ConstTerm is printed as the Symbol it holds.

  Returns:
    the String for the contained Symbol
  Overrides:
    toString in class Object

equals

     public boolean equals(Object otherTerm)

  A ConstTerm is equal to any other ConstTerm that holds the same Symbol. It never equals a VarTerm or any other kind of Term.

  Parameters:
    otherTerm - the Object this Term is compared to
  Returns:
    whether the given Object equals this ConstTerm
  Overrides:
    equals in class Term

getSymbol

     public Symbol getSymbol()

  This function can be used to extract the Symbol contained in this ConstTerm.

  Returns:
    the Symbol contained in this ConstTerm

    All Packages  Class Hierarchy  This Package  Previous  Next  Index