示例#1
0
文件: Term.java 项目: rla/llj
  /** Assumes that the first argument is certanly variable. */
  @Predicate(name = "functor_vii", arity = 3)
  public AbstractGoal functor_vii(JavaCallGoal goal) throws Exception {
    // FIXME check overflow?
    Integer arity = (int) goal.getLongArg(2);
    String functor = (String) goal.getStringArg(1);

    Object[] data = new Object[arity + 1];
    for (int i = 0; i < arity; i++) {
      data[i + 1] = new RuntimeVariable();
    }
    data[0] = functor;

    goal.setVar(0, new RuntimeStruct(data));

    return goal.G;
  }
示例#2
0
文件: Map.java 项目: rla/llj
  @Predicate(name = "map_new", arity = 1)
  public AbstractGoal newMap(JavaCallGoal goal) throws Exception {
    goal.setVar(0, new HashMap<Object, Object>());

    return goal.G;
  }