Esempio n. 1
0
File: Map.java Progetto: rla/llj
  @SuppressWarnings("unchecked")
  @Predicate(name = "map_set", arity = 3)
  public AbstractGoal putMap(JavaCallGoal goal) throws Exception {
    ((java.util.Map<Object, Object>) goal.getArg(0)).put(goal.getArg(1), goal.getArg(2));

    return goal.G;
  }
Esempio n. 2
0
File: Term.java Progetto: 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;
  }
Esempio n. 3
0
File: Term.java Progetto: 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();
    }
  }
Esempio n. 4
0
File: Map.java Progetto: 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();
    }
  }
Esempio n. 5
0
File: Term.java Progetto: rla/llj
 @Predicate(name = "functor", arity = 3)
 public AbstractGoal functor(JavaCallGoal goal) throws Exception {
   if (goal.getArg(0).getClass() == RuntimeVariable.class) {
     return functor_vii(goal);
   } else {
     return functor_ioo(goal);
   }
 }
Esempio n. 6
0
File: Term.java Progetto: 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();
   }
 }