📄 testcase.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.validation;
import org.mandarax.kernel.*;
/**
* Test case that can be used to validate a knowledge base.
* Modelled after JUnit test cases, although this interface does not depend on JUnit.
* A reference implementation based on JUnit is provided as well.
* <p>
* The test case can validate the following:
* <ol>
* <li>whether a ground query yields true or false</li>
* <li>the expected variable replacements in a query containing variables</li>
* <li>the number of expected results</li>
* </ol>
* @author <A HREF="mailto:j.b.dietrich@massey.ac.nz">Jens Dietrich</A>
* @version 3.4 <7 March 05>
* @since 3.4
*/
public interface TestCase extends PropertiesSupport {
// public constants representing policies how assumptions should be integrated into the kb
// ON_TOP can be used in conjunction with the ExtendedKnowledgeBase that has an API to give
// clause sets top priority
public static final int ON_TOP = 0;
public static final int AT_BOTTOM = 1;
/**
* Prepares the test case.
*/
public void prepare() throws Exception ;
/**
* Releases the test case.
*/
public void release() throws Exception ;
/**
* Execute the test case.
*/
public abstract void execute() throws Exception ;
/**
* Get the assumptions.
* @return Returns the assumptions.
*/
public ClauseSet[] getAssumptions() ;
/**
* Set the assumptions.
* @param assumptions The assumptions to set.
*/
public void setAssumptions(ClauseSet[] assumptions);
/**
* Get the test knowledge base.
* @return Returns the kb.
*/
public KnowledgeBase getKb() ;
/**
* Set the test knowledge base.
* @param kb The kb to set.
*/
public void setKb(KnowledgeBase kb);
/**
* Set the test query.
* @return Returns the query.
*/
public Query getQuery() ;
/**
* Set the test query.
* @param query The query to set.
*/
public void setQuery(Query query) ;
/**
* @return Returns the expectedNumberOfResults.
*/
public int getExpectedNumberOfResults() ;
/**
* @param expectedNumberOfResults The expectedNumberOfResults to set.
*/
public void setExpectedNumberOfResults(int expectedNumberOfResults) ;
/**
* Get an array of maps containing variable term -> constant term mapping expected in the result
* at this position.
* Can be null indicating that this condition will not be checked in this test case.
* @return Returns the expectedReplacements.
*/
public java.util.Map[] getExpectedReplacements() ;
/**
* Set an array of maps containing variable term -> constant term mapping expected in the result
* at this position.
* Can be null indicating that this condition will not be checked in this test case.
* @param expectedReplacements The expectedReplacements to set.
*/
public void setExpectedReplacements(java.util.Map[] expectedReplacements) ;
/**
* Indicates whether a test case must yield true.
* Only used if the query is ground (does not have variables).
* @return Returns the mustBeTrue.
*/
public boolean isMustBeTrue() ;
/**
* Sets whether a test case must yield true.
* Only used if the query is ground (does not have variables).
* @param mustBeTrue The mustBeTrue to set.
*/
public void setMustBeTrue(boolean mustBeTrue) ;
/**
* Set the policy to add an assumption.
* @param policy the (encoded) policy = one of the constants defined in TestCase
*/
public void setPolicyToAddAssumptionsToKB(int policy) ;
/**
* Get the policy to add an assumption.
* @return an integer, the (encoded) policy = one of the constants defined in TestCase
*/
public int getPolicyToAddAssumptionsToKB() ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -