📄 term.java
字号:
/*
* Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.mandarax.kernel;
import org.mandarax.util.TermIterator;
import java.util.*;
/**
* A term is either a variable, a name or a compound term containing a function.
* Note that instances are usually created using a factory.
* @see org.mandarax.kernel.LogicFactory
* @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
* @version 3.4 <7 March 05>
* @since 1.0
* Prova re-integration modifications
* @author <A HREF="mailto:a.kozlenkov@city.ac.uk">Alex Kozlenkov</A>
* @version 3.4 <7 March 05>
*/
public interface Term extends SemanticsSupport, java.io.Serializable {
/**
* Get a term iterator for the subterms.
* @return an iterator for all subterms
*/
TermIterator allSubterms();
/**
* Apply a substitution to a term.
* @return the term resulting from applying the replacement
* @param r a replacement
*/
Term apply(Replacement r);
/**
* Indicates whether the term containes variables.
* @return true if the term contains variables, false otherwise
*/
public boolean containsVariables();
/**
* Indicates whether the term contains the provided variable term.
* @return true if the term contains the variable term provided, false otherwise
* @param var a variable term
*/
public boolean containsVariable( VariableTerm var );
/**
* Get all subterms as array.
* @return an array of all subterms
*/
Term[] getAllSubterms();
void getAllSubtermsA( List result );
void getAllSubtermsA( List result, boolean left );
public boolean getAllSubtermsB( List result, Iterator aux );
public boolean getAllSubtermsB( List result, Iterator aux, boolean left );
/**
* Get the type of the term.
* @return the type of the term
*/
Class getType();
/**
* Indicates whether the term is compound.
* @return true if this is a compound term, false otherwise
*/
public boolean isCompound();
/**
* Indicates whether the term is a constant.
* @return true if this is a constant term, false otherwise
*/
public boolean isConstant();
/**
* Indicates whether the term is a variable.
* @return true if this is a variable term, false otherwise
*/
public boolean isVariable();
/**
* Resolve a term. This operation is most meaningfull for
* complex terms : if supported, the function should be performed using its semantic.
* <br>
* In version 3.2, a session parameter has been added. A session provides a context that
* allows to "resolve" terms locally, i.e., w.r.t. an InferenceEngine session.
* Most implementations can ignore this parameter.
* @param session a session object
* @see org.mandarax.kernel.ComplexTerm#resolve
* @return the result of resolving the term
* @throws java.lang.UnsupportedOperationException
* @throws java.lang.IllegalArgumentException
*/
Object resolve(Session session) throws UnsupportedOperationException, IllegalArgumentException;
// /**
// * Prova version taken from older Mandarax.
// * Resolve a term. This operation is most meaningfull for
// * complex terms : if supported, the function
// * should be performed using its semantic.
// * @see org.mandarax.kernel.ComplexTerm#resolve
// * @return the result of resolving the term
// * @throws java.lang.UnsupportedOperationException
// * @throws java.lang.IllegalArgumentException
// */
// Object resolve()
// throws UnsupportedOperationException, IllegalArgumentException;
/**
* Indicates whether the object is the same as the parameter.
* @return boolean
* @param t org.mandarax.kernel.Term
*/
boolean sameAs(Term t);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -