本文整理汇总了Java中gnu.prolog.vm.PrologException.domainError方法的典型用法代码示例。如果您正苦于以下问题:Java PrologException.domainError方法的具体用法?Java PrologException.domainError怎么用?Java PrologException.domainError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.prolog.vm.PrologException
的用法示例。
在下文中一共展示了PrologException.domainError方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import gnu.prolog.vm.PrologException; //导入方法依赖的package包/类
@Override
public int execute(Interpreter interpreter, boolean backtrackMode,
Term[] args) throws PrologException {
RuleEvent re = getRuleEvent(args[0]);
if (!(re instanceof BasicEvent)) {
PrologException.domainError(RULEEVENT_ATOM, args[0]);
}
BasicEvent spo = (BasicEvent) re;
if (!(args[1] instanceof JavaObjectTerm)) {
PrologException.instantiationError();
}
Object arg1 = ((JavaObjectTerm) args[1]).value;
Object arg1Transposed = null;
if (arg1 instanceof Node) {
arg1Transposed = spo.getAnchorMap().getNode((RuleNode) arg1);
} else if (arg1 instanceof Edge) {
arg1Transposed = spo.getAnchorMap().getEdge((RuleEdge) arg1);
} else {
PrologException.domainError(AtomTerm.get("node_edge"), args[1]);
}
if (arg1Transposed == null) {
return FAIL;
}
Term res = new JavaObjectTerm(arg1Transposed);
return interpreter.unify(args[2], res);
}
示例2: getGraph
import gnu.prolog.vm.PrologException; //导入方法依赖的package包/类
/**
* Get a graph from a term representing a graph
* @param term A term representing a graph
* @return A graph
*/
public static final Graph getGraph(Term term) throws PrologException {
if (term instanceof JavaObjectTerm) {
JavaObjectTerm jot = (JavaObjectTerm) term;
if (jot.value instanceof GraphState) {
return ((GraphState) jot.value).getGraph();
}
if (jot.value instanceof Graph) {
return (Graph) jot.value;
}
PrologException.domainError(GraphPrologCode.GRAPH_ATOM, term);
} else {
PrologException.typeError(GraphPrologCode.GRAPH_ATOM, term);
}
return null;
}
示例3: getHostGraph
import gnu.prolog.vm.PrologException; //导入方法依赖的package包/类
/**
* Get a host graph from a term representing a host graph
* @param term A term representing a host graph
* @return A host graph
*/
public static final HostGraph getHostGraph(Term term)
throws PrologException {
if (term instanceof JavaObjectTerm) {
JavaObjectTerm jot = (JavaObjectTerm) term;
if (jot.value instanceof GraphState) {
return ((GraphState) jot.value).getGraph();
}
if (jot.value instanceof HostGraph) {
return (HostGraph) jot.value;
}
PrologException.domainError(GraphPrologCode.GRAPH_ATOM, term);
} else {
PrologException.typeError(GraphPrologCode.GRAPH_ATOM, term);
}
return null;
}
示例4: getValueNode
import gnu.prolog.vm.PrologException; //导入方法依赖的package包/类
/**
* Gets a valuenode from a term
* @param term A term representing a valuenode
* @return A valuenode
*/
public static final ValueNode getValueNode(Term term)
throws PrologException {
if (term instanceof JavaObjectTerm) {
JavaObjectTerm jot = (JavaObjectTerm) term;
if (!(jot.value instanceof ValueNode)) {
PrologException.domainError(VALUENODE_ATOM, term);
}
return (ValueNode) jot.value;
} else {
PrologException.typeError(VALUENODE_ATOM, term);
}
return null;
}
示例5: getRuleEvent
import gnu.prolog.vm.PrologException; //导入方法依赖的package包/类
/**
* Get a rule event from a term representing a rule event
* @param term A term representing a rule event
* @return A rule event
*/
public static final RuleEvent getRuleEvent(Term term)
throws PrologException {
if (term instanceof JavaObjectTerm) {
JavaObjectTerm jot = (JavaObjectTerm) term;
if (!(jot.value instanceof RuleEvent)) {
PrologException.domainError(RULEEVENT_ATOM, term);
}
return (RuleEvent) jot.value;
} else {
PrologException.typeError(RULEEVENT_ATOM, term);
}
return null;
}
示例6: getRule
import gnu.prolog.vm.PrologException; //导入方法依赖的package包/类
/**
* Get a rule from a term representing a rule
* @param term A term representing a rule
* @return A rule
*/
public static final Rule getRule(Term term) throws PrologException {
if (term instanceof JavaObjectTerm) {
JavaObjectTerm jot = (JavaObjectTerm) term;
if (!(jot.value instanceof Rule)) {
PrologException.domainError(RULE_ATOM, term);
}
return (Rule) jot.value;
} else {
PrologException.typeError(RULE_ATOM, term);
}
return null;
}
示例7: getGraphState
import gnu.prolog.vm.PrologException; //导入方法依赖的package包/类
/**
* Get a graph state from a term representing a graph state
* @param term A term representing a graph state
* @return A graph state
*/
public static final GraphState getGraphState(Term term)
throws PrologException {
if (term instanceof JavaObjectTerm) {
JavaObjectTerm jot = (JavaObjectTerm) term;
if (!(jot.value instanceof GraphState)) {
PrologException.domainError(LtsPrologCode.GRAPHSTATE_ATOM, term);
}
return (GraphState) jot.value;
} else {
PrologException.typeError(LtsPrologCode.GRAPHSTATE_ATOM, term);
}
return null;
}
示例8: getLTS
import gnu.prolog.vm.PrologException; //导入方法依赖的package包/类
/**
* Get a GTS from a term representing a GTS
* @param term A term representing a GTS
* @return A GTS
*/
public static final GTS getLTS(Term term) throws PrologException {
if (term instanceof JavaObjectTerm) {
JavaObjectTerm jot = (JavaObjectTerm) term;
if (!(jot.value instanceof GTS)) {
PrologException.domainError(LtsPrologCode.GTS_ATOM, term);
}
return (GTS) jot.value;
} else {
PrologException.typeError(LtsPrologCode.GTS_ATOM, term);
}
return null;
}
示例9: getTransition
import gnu.prolog.vm.PrologException; //导入方法依赖的package包/类
/**
* Get a graph transition from a term representing a graph transition
* @param term A term representing a graph transition
* @return A graph transition
*/
public static final RuleTransition getTransition(Term term)
throws PrologException {
if (term instanceof JavaObjectTerm) {
JavaObjectTerm jot = (JavaObjectTerm) term;
if (!(jot.value instanceof RuleTransition)) {
PrologException.domainError(LtsPrologCode.TRANSITION_ATOM, term);
}
return (RuleTransition) jot.value;
} else {
PrologException.typeError(LtsPrologCode.TRANSITION_ATOM, term);
}
return null;
}
示例10: getEdge
import gnu.prolog.vm.PrologException; //导入方法依赖的package包/类
/**
* Get an edge from a term representing an edge
* @param term A term representing an edge
* @return An edge
*/
public static final Edge getEdge(Term term) throws PrologException {
if (term instanceof JavaObjectTerm) {
JavaObjectTerm jot = (JavaObjectTerm) term;
if (!(jot.value instanceof Edge)) {
PrologException.domainError(GraphPrologCode.EDGE_ATOM, term);
}
return (Edge) jot.value;
} else {
PrologException.typeError(GraphPrologCode.EDGE_ATOM, term);
}
return null;
}
示例11: getNode
import gnu.prolog.vm.PrologException; //导入方法依赖的package包/类
/**
* Get a node from a term representing a node
* @param term A term representing a node
* @return A node
*/
public static final Node getNode(Term term) throws PrologException {
if (term instanceof JavaObjectTerm) {
JavaObjectTerm jot = (JavaObjectTerm) term;
if (!(jot.value instanceof Node)) {
PrologException.domainError(GraphPrologCode.NODE_ATOM, term);
}
return (Node) jot.value;
} else {
PrologException.typeError(GraphPrologCode.NODE_ATOM, term);
}
return null;
}