Exemple #1
0
 ListTerm deleteFromList(int index, ListTerm l) {
   ListTerm r = new ListTermImpl();
   ListTerm last = r;
   int i = 0;
   for (Term t : l) {
     if ((i++) != index) last = last.append(t.clone());
   }
   return r;
 }
Exemple #2
0
 ListTerm deleteFromList(Term element, ListTerm l, Unifier un) {
   Unifier bak = un;
   ListTerm r = new ListTermImpl();
   ListTerm last = r;
   for (Term t : l) {
     boolean u = un.unifies(element, t);
     if (u) un = bak.clone();
     else last = last.append(t.clone());
   }
   return r;
 }
Exemple #3
0
  @Override
  public Object execute(TransitionSystem ts, Unifier un, Term[] args) throws Exception {
    checkArguments(args);

    StringTerm st = (StringTerm) args[0];
    HouseModel hm = getTerrain(ts);
    if (hm == null) return false;
    String[] array = hm.planRoute(ts.getUserAgArch().getAgName(), st.getString());
    if (array == null) return false;

    ListTerm ln = new ListTermImpl();
    ListTerm tail = ln;

    for (String orientation : array) {
      tail = tail.append(ASSyntax.createString(orientation));
    }

    return un.unifies(args[1], ln);
  }