z450_fx_GfmlDefaultItem_fxt.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. XOWA: the XOWA Offline Wiki Application
  3. Copyright (C) 2012-2017 gnosygnu@gmail.com
  4. XOWA is licensed under the terms of the General Public License (GPL) Version 3,
  5. or alternatively under the terms of the Apache License Version 2.0.
  6. You may use XOWA according to either of these licenses as is most appropriate
  7. for your project on a case-by-case basis.
  8. The terms of each license can be found in the source code repository:
  9. GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
  10. Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
  11. */
  12. package gplx.gfml; import gplx.*;
  13. class GfmlDefaultItem_fxt {
  14. @gplx.Internal protected GfmlDefaultItem make_(String typeKey, String key, GfmlTkn val) {return GfmlDefaultItem.new_(typeKey, key, val);}
  15. @gplx.Internal protected GfmlDefaultItem make_(String typeKey, String key, String val) {return GfmlDefaultItem.new_(typeKey, key, GfmlTkn_.raw_(val));}
  16. @gplx.Internal protected void tst_Item(GfmlDefaultItem actl, GfmlDefaultItem expd) {
  17. Tfds.Eq(expd.TypeKey(), actl.TypeKey());
  18. Tfds.Eq(expd.Key(), actl.Key());
  19. Tfds.Eq(GfmlFld_mok.XtoRaw(expd.Val()), GfmlFld_mok.XtoRaw(actl.Val()));
  20. Tfds.Eq(Val_to_str_or_null(expd.ValPrev()), Val_to_str_or_null(actl.ValPrev()));
  21. }
  22. @gplx.Internal protected void tst_List(List_adp list, GfmlDefaultItem... expdAry) {
  23. for (int i = 0; i < expdAry.length; i++) {
  24. GfmlDefaultItem actl = (GfmlDefaultItem)list.Get_at(i);
  25. GfmlDefaultItem expd = expdAry[i];
  26. tst_Item(actl, expd);
  27. }
  28. Tfds.Eq(expdAry.length, list.Count());
  29. }
  30. String Val_to_str_or_null(GfmlObj gobj) {
  31. GfmlTkn tkn = GfmlTkn_.as_(gobj);
  32. return tkn == null ? null : tkn.Val();
  33. }
  34. public static GfmlDefaultItem_fxt new_() {return new GfmlDefaultItem_fxt();} GfmlDefaultItem_fxt() {}
  35. }