Exemple #1
0
 String ArgsXtoStr() {
   if (this.Args_count() == 0) return "<<EMPTY>>";
   String_bldr sb = String_bldr_.new_();
   for (int i = 0; i < this.Args_count(); i++) {
     Keyval rv = (Keyval) this.Args_getAt(i);
     sb.Add_fmt("{0};", rv.Key());
   }
   return sb.To_str();
 }
Exemple #2
0
 @gplx.Virtual
 protected Object ReadOr(String k, Object defaultOr) {
   if (args == null) return Nil; // WORKAROUND.gfui: args null for DataBndr_whenEvt_execCmd
   if (!String_.Eq(k, "")) {
     for (int i = 0; i < args.Count(); i++) {
       Keyval kv = (Keyval) args.Get_at(i);
       if (String_.Eq(k, kv.Key())) return kv.Val();
     }
   }
   if (counter >= args.Count()) return Nil;
   for (int i = 0; i < args.Count(); i++) {
     Keyval kv = (Keyval) args.Get_at(i);
     if (String_.Eq(kv.Key(), "") && i >= counter) {
       counter++;
       return kv.Val();
     }
   }
   return Nil;
 }
Exemple #3
0
 public GfoMsg Args_ovr(String k, Object v) {
   if (args == null) args = List_adp_.New();
   for (int i = 0; i < args.Count(); i++) {
     Keyval kv = (Keyval) args.Get_at(i);
     if (String_.Eq(k, kv.Key())) {
       kv.Val_(v);
       return this;
     }
   }
   args.Add(Keyval_.new_(k, v));
   return this;
 }
Exemple #4
0
 public static GfoMsg root_leafArgs_(String[] ary, Keyval... kvAry) {
   int len = Array_.Len(ary);
   if (len == 0) throw Err_.new_invalid_arg("== 0", "@len", len);
   GfoMsg root = new GfoMsg_base().ctor_(ary[0], false);
   GfoMsg owner = root;
   for (int i = 1; i < len; i++) {
     String key = ary[i];
     GfoMsg cur = new GfoMsg_base().ctor_(key, false);
     owner.Subs_add(cur);
     owner = cur;
   }
   for (int i = 0; i < kvAry.length; i++) {
     Keyval kv = kvAry[i];
     owner.Add(kv.Key(), kv.Val());
   }
   return root;
 }
Exemple #5
0
 void To_str(String_bldr sb, XtoStrWkr wkr, GfoMsg m) {
   sb.Add(m.Key());
   if (m.Subs_count() == 0) {
     sb.Add(":");
     boolean first = true;
     for (int i = 0; i < m.Args_count(); i++) {
       Keyval kv = m.Args_getAt(i);
       if (kv.Val() == null) continue;
       if (!first) sb.Add(" ");
       sb.Add(kv.Key());
       sb.Add("='");
       sb.Add(wkr.To_str(kv.Val()));
       sb.Add("'");
       first = false;
     }
     sb.Add(";");
   } else {
     sb.Add(".");
     To_str(sb, wkr, m.Subs_getAt(0));
   }
 }