示例#1
0
文件: Term.java 项目: rla/llj
  @Predicate(name = "copy_term", arity = 2)
  public AbstractGoal copyTerm(JavaCallGoal goal) throws Exception {
    Object left = RuntimeVariable.copyTerm(goal.getArg(0));
    if (!goal.Q.unify(left, goal.getArg(1))) {
      return goal.Q.backtrack();
    }

    return goal.G;
  }
示例#2
0
文件: Term.java 项目: rla/llj
  @Predicate(name = "functor_ioo", arity = 3)
  public AbstractGoal functor_ioo(JavaCallGoal goal) throws Exception {
    RuntimeStruct struct = goal.getStructArg(0);
    Integer arity = struct.data.length - 1;
    String functor = (String) struct.data[0];

    if (goal.Q.unify(goal.getArg(1), functor) && goal.Q.unify(goal.getArg(2), arity)) {
      return goal.G;
    } else {
      return goal.Q.backtrack();
    }
  }
示例#3
0
文件: Map.java 项目: rla/llj
  @SuppressWarnings("unchecked")
  @Predicate(name = "map_get", arity = 3)
  public AbstractGoal getMap(JavaCallGoal goal) throws Exception {
    Object a3 = goal.getArg(2);
    Object o = ((java.util.Map<Object, Object>) goal.getArg(0)).get(goal.getArg(1));

    if (goal.Q.unify(a3, o)) {
      return goal.G;
    } else {
      return goal.Q.backtrack();
    }
  }
示例#4
0
文件: Term.java 项目: rla/llj
 @Predicate(name = "var", arity = 1)
 public AbstractGoal var(JavaCallGoal goal) throws Exception {
   Object a1 = goal.getArg(0);
   if (a1.getClass() == RuntimeVariable.class) {
     return goal.G;
   } else {
     return goal.Q.backtrack();
   }
 }