示例#1
0
 static void Args_reset(GfoMsg owner) {
   int len = owner.Subs_count();
   for (int i = 0; i < len; i++) {
     GfoMsg sub = owner.Subs_getAt(i);
     sub.Args_reset();
   }
 }
示例#2
0
  public static GfoMsg chain_(GfoMsg owner, String key) {
    GfoMsg sub = owner;
    List_adp list = List_adp_.New();
    list.Add(sub.Key());
    while (sub != null) {
      if (sub.Subs_count() == 0) break;
      sub = (GfoMsg) sub.Subs_getAt(0);
      list.Add(sub.Key());
    }
    list.Add(key);

    GfoMsg root = GfoMsg_.new_parse_((String) list.Get_at(0));
    GfoMsg cur = root;
    for (int i = 1; i < list.Count(); i++) {
      String k = (String) list.Get_at(i);
      GfoMsg mm = GfoMsg_.new_parse_(k);
      cur.Subs_add(mm);
      cur = mm;
    }
    return root;
  }
示例#3
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));
   }
 }