is.lill.acre.logic
Class Term

java.lang.Object
  extended by is.lill.acre.logic.Term

public class Term
extends java.lang.Object

A logic term within an ACRE conversation


Field Summary
static int CONSTANT
           
static int FUNCTION
           
static int PREDICATE
           
static int VARIABLE
           
 
Constructor Summary
Term()
           
 
Method Summary
 void addArgument(Term arg)
           
 Term applyBindings(Bindings b)
          Apply a set of bindings to this term, replacing any variable with its binding in b, if present.
 Term clone()
          Generate a clone of this term
 boolean equals(Term t)
          Determine whether this term is equal to another.
 java.util.List<Term> getArguments()
          Get the arguments of this term
 Bindings getBindings(Term t)
          Compare this term to another and generate a set of bindings between any variables present within this term and any values they match in the given term.
 java.lang.String getFunctor()
          Get the functor of this term
 boolean isAnonymousVariable()
           
 boolean isConstant()
          Check if this term is a constant (i.e.
 boolean isFunction()
          Check if this term is a function
 boolean isMutable()
          Check if this term is mutable
 boolean isPredicate()
          Check if this term is a predicate
 boolean isVariable()
          Check if this represents a variable term
 boolean matches(Term t)
          Check if this term matches another term.
 void setFunctor(java.lang.String functor)
           
 void setMutable(boolean mutable)
           
 void setType(int type)
           
 java.lang.String toDebuggingString()
          To print debugging information on Terms
 java.lang.String toString()
          toString calls dotted around the code.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VARIABLE

public static int VARIABLE

CONSTANT

public static int CONSTANT

PREDICATE

public static int PREDICATE

FUNCTION

public static int FUNCTION
Constructor Detail

Term

public Term()
Method Detail

addArgument

public void addArgument(Term arg)

isVariable

public boolean isVariable()
Check if this represents a variable term

Returns:
true if this term is a variable, false otherwise

isAnonymousVariable

public boolean isAnonymousVariable()

isMutable

public boolean isMutable()
Check if this term is mutable

Returns:
true if the term is mutable, false otherwise

setMutable

public void setMutable(boolean mutable)

setFunctor

public void setFunctor(java.lang.String functor)

setType

public void setType(int type)

isConstant

public boolean isConstant()
Check if this term is a constant (i.e. a no-argument function)

Returns:
true if the term is constant, false otherwise

isPredicate

public boolean isPredicate()
Check if this term is a predicate

Returns:
true if the term is a predicate, false otherwise

isFunction

public boolean isFunction()
Check if this term is a function

Returns:
true if the term is a function, false otherwise

matches

public boolean matches(Term t)
Check if this term matches another term. A match happens if:

Parameters:
t - A second term to check for a match against
Returns:
true if the terms match, false otherwise.

getFunctor

public java.lang.String getFunctor()
Get the functor of this term

Returns:
The functor

applyBindings

public Term applyBindings(Bindings b)
Apply a set of bindings to this term, replacing any variable with its binding in b, if present.

Parameters:
b - A set of bindings to apply
Returns:
The term after applying the bindings provided.

getBindings

public Bindings getBindings(Term t)
Compare this term to another and generate a set of bindings between any variables present within this term and any values they match in the given term.

Parameters:
t - Another term to match against
Returns:
A set of bindings from matching the variables in this object with constant values in t.

clone

public Term clone()
Generate a clone of this term

Overrides:
clone in class java.lang.Object
Returns:
A clone of this term

equals

public boolean equals(Term t)
Determine whether this term is equal to another. Terms are equal if:

Parameters:
t - Another term to compare with
Returns:
true if the terms are equal, false otherwise

getArguments

public java.util.List<Term> getArguments()
Get the arguments of this term

Returns:

toString

public java.lang.String toString()
toString calls dotted around the code. Shouldn't be used as I've now switched to formatters/parsers

Overrides:
toString in class java.lang.Object

toDebuggingString

public java.lang.String toDebuggingString()
To print debugging information on Terms

Returns: