📄 cut.java
字号:
package org.mandarax.lib;
/*
* Copyright (C) 1999-2004 <a href="mailto:jens.dietrich@unforgettable.com">Jens Dietrich</a>
* Copyright (C) 1999-2004 <a href="mailto:a.kozlenkov@city.ac.uk">Alex Kozlenkov</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
*/
import org.mandarax.util.logging.LogCategories;
import org.mandarax.kernel.*;
/**
* Prolog like cut predicate,
* @author <A HREF="mailto:jens.dietrich@unforgettable.com">Jens Dietrich</A>
* @author <A HREF="mailto:a.kozlenkov@city.ac.uk">Alex Kozlenkov</A>
* @version 3.4 <7 March 05>
* @since 2.1
* Prova re-integration modifications
* @author <A HREF="mailto:a.kozlenkov@city.ac.uk">Alex Kozlenkov</A>
* @version 3.4 <7 March 05>
*/
public class Cut implements Predicate {
// Further corrections 28/04/03
public transient int cutPredicate;
private static final Class[] STRUCT = {};
private static final String[] SLOT_NAMES = {};
/**
* Get the predicate structure.
* @return an array of types (classes)
*/
public Class[] getStructure() {
return STRUCT;
}
/**
* Indicates whether the predicate is executable.
* @return a boolean
*/
public boolean isExecutable() {
return false;
}
/**
* Get the name of the predicate.
* @return a string
*/
public String getName() {
return "CUT["+cutPredicate+"]";
}
/**
* Perform the predicate.
* @param terms an array of term
* @param session a session object
* @return a string
*/
public Object perform(Term[] terms,Session session) {
throw new UnsupportedOperationException("Cut does not support perform");
}
/**
* Converts the object to a string.
* @return the string representation of this object
*/
public String toString() {
return "CUT("+cutPredicate+")";
}
/**
* Get the slot names.
* @return an array of strings, the length of the array is the same as
* the length of the array of terms (the structure of the predicate)
*/
public String[] getSlotNames() {
return SLOT_NAMES;
}
/**
* Set the slot names.
* @param names an array of strings, the length of the array is the same as
* the length of the array of terms (the structure of the predicate)
*/
public void setSlotNames(String[] names) {
LogCategories.LOG_KB.debug("Ignore attempt to set slot names for cut predicate");
// ignored
}
/**
* Indicates whether the slot names can be modified.
* @return a boolean
*/
public boolean slotNamesCanBeEdited() {
return false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -