From 5e2ce08abbc327d96000ffeec9d94ab1a83ca7a2 Mon Sep 17 00:00:00 2001 From: gnosygnu Date: Sun, 5 Jan 2020 08:52:37 -0500 Subject: [PATCH] Xomw: Standardize static classes [#633] --- 100_core/src/gplx/Char_.java | 2 +- 100_core/src/gplx/Long_.java | 2 +- .../src/gplx/xowa/mediawiki/XophpArray.java | 63 ++++++----- .../{XophpArrayUtl.java => XophpArray_.java} | 102 ++++++++---------- ...ArrayUtl_tst.java => XophpArray__tst.java} | 38 +++---- .../gplx/xowa/mediawiki/XophpArray_tst.java | 8 +- .../{XophpBool.java => XophpBool_.java} | 2 +- ...XophpBool_tst.java => XophpBool__tst.java} | 10 +- .../src/gplx/xowa/mediawiki/XophpBry_.java | 19 ---- .../{XophpEncode.java => XophpEncode_.java} | 2 +- .../src/gplx/xowa/mediawiki/XophpInt_.java | 2 +- .../{XophpMath.java => XophpMath_.java} | 12 +-- .../gplx/xowa/mediawiki/XophpMath__tst.java | 2 +- .../src/gplx/xowa/mediawiki/XophpObject.java | 22 ---- .../{XophpUtility.java => XophpObject_.java} | 7 +- ...Utility_tst.java => XophpObject__tst.java} | 8 +- .../{XophpPreg.java => XophpPreg_.java} | 2 +- ...XophpPreg_tst.java => XophpPreg__tst.java} | 8 +- .../src/gplx/xowa/mediawiki/XophpRegex_.java | 2 +- .../src/gplx/xowa/mediawiki/XophpString_.java | 2 +- .../gplx/xowa/mediawiki/XophpString__tst.java | 2 +- .../src/gplx/xowa/mediawiki/XophpType.java | 2 +- .../{XophpTypeUtl.java => XophpType_.java} | 2 +- .../{XophpUrl.java => XophpUrl_.java} | 2 +- .../JsonConfig/includes/JCValue.java | 4 +- .../xowa/mediawiki/includes/XomwLinker.java | 68 ++++++------ .../mediawiki/includes/XomwNamespace.java | 2 +- .../includes/XomwNamespacesByName.java | 2 +- .../mediawiki/includes/XomwSanitizer.java | 4 +- .../localisation/XomwLocalisationCache.java | 4 +- .../includes/content/ContentHandler.java | 2 +- .../includes/filerepo/file/XomwFile.java | 10 +- .../interwiki/XomwInterwikiLookupAdapter.java | 4 +- .../includes/libs/XomwGenericArrayObject.java | 4 +- .../includes/linkers/XomwLinkRenderer.java | 2 +- .../includes/media/XomwImageHandler.java | 20 ++-- .../includes/media/XomwImageHandler_tst.java | 2 +- .../includes/media/XomwThumbnailImage.java | 34 +++--- .../includes/parsers/XomwBlockLevelPass.java | 6 +- .../parsers/XomwPreprocessor_DOM.java | 4 +- .../parsers/XomwPreprocessor_Hash.java | 26 ++--- .../includes/parsers/lnkes/Xomw_lnke_wkr.java | 2 +- .../includes/parsers/lnkis/Xomw_lnki_wkr.java | 4 +- .../parsers/lnkis/Xomw_params_frame.java | 4 +- .../parsers/lnkis/Xomw_params_handler.java | 2 +- .../parsers/lnkis/Xomw_params_scalar.java | 2 +- .../parsers/preprocessors/XomwPPDStack.java | 14 +-- .../preprocessors/XomwPPDStackElement.java | 10 +- .../XomwPPDStackElement_Hash.java | 8 +- .../preprocessors/XomwPPFrame_Hash.java | 58 +++++----- .../preprocessors/XomwPPNode_Hash_Text.java | 2 +- .../preprocessors/XomwPPNode_Hash_Tree.java | 12 +-- .../parsers/quotes/Xomw_quote_wkr.java | 2 +- .../parsers/tables/Xomw_table_wkr.java | 36 +++---- .../includes/site/XomwMediaWikiSite.java | 4 +- .../mediawiki/includes/site/XomwSite.java | 6 +- .../mediawiki/includes/site/XomwSiteList.java | 16 +-- .../title/XomwMediaWikiTitleCodec.java | 4 +- .../mediawiki/languages/XomwLanguage.java | 20 ++-- .../src/Converter/XomwOperator.java | 4 +- .../src/XomwConverter.java | 6 +- .../src/XomwEvaluator.java | 12 +-- .../src/XomwRange.java | 6 +- .../xowa/xtns/pfuncs/langs/Pfunc_plural.java | 4 +- .../xowa/xtns/proofreadPage/Pp_pages_nde.java | 2 +- .../scribunto/libs/Scrib_lib_language.java | 2 +- 66 files changed, 353 insertions(+), 410 deletions(-) rename 400_xowa/src/gplx/xowa/mediawiki/{XophpArrayUtl.java => XophpArray_.java} (83%) rename 400_xowa/src/gplx/xowa/mediawiki/{XophpArrayUtl_tst.java => XophpArray__tst.java} (81%) rename 400_xowa/src/gplx/xowa/mediawiki/{XophpBool.java => XophpBool_.java} (96%) rename 400_xowa/src/gplx/xowa/mediawiki/{XophpBool_tst.java => XophpBool__tst.java} (81%) delete mode 100644 400_xowa/src/gplx/xowa/mediawiki/XophpBry_.java rename 400_xowa/src/gplx/xowa/mediawiki/{XophpEncode.java => XophpEncode_.java} (95%) rename 400_xowa/src/gplx/xowa/mediawiki/{XophpMath.java => XophpMath_.java} (90%) delete mode 100644 400_xowa/src/gplx/xowa/mediawiki/XophpObject.java rename 400_xowa/src/gplx/xowa/mediawiki/{XophpUtility.java => XophpObject_.java} (86%) rename 400_xowa/src/gplx/xowa/mediawiki/{XophpUtility_tst.java => XophpObject__tst.java} (88%) rename 400_xowa/src/gplx/xowa/mediawiki/{XophpPreg.java => XophpPreg_.java} (96%) rename 400_xowa/src/gplx/xowa/mediawiki/{XophpPreg_tst.java => XophpPreg__tst.java} (86%) rename 400_xowa/src/gplx/xowa/mediawiki/{XophpTypeUtl.java => XophpType_.java} (95%) rename 400_xowa/src/gplx/xowa/mediawiki/{XophpUrl.java => XophpUrl_.java} (96%) diff --git a/100_core/src/gplx/Char_.java b/100_core/src/gplx/Char_.java index 55b0792c8..f9140a9ed 100644 --- a/100_core/src/gplx/Char_.java +++ b/100_core/src/gplx/Char_.java @@ -56,7 +56,7 @@ public class Char_ { if (itm == match) return true; return false; } - public static int To_int_or(char c, int or) { + public static int To_digit_or(char c, int or) { switch (c) { case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9; diff --git a/100_core/src/gplx/Long_.java b/100_core/src/gplx/Long_.java index f6fd0d132..e8c70dcf3 100644 --- a/100_core/src/gplx/Long_.java +++ b/100_core/src/gplx/Long_.java @@ -40,7 +40,7 @@ public class Long_ { if (raw == null || rawLen == 0) return or; long rv = 0, factor = 1; int tmp = 0; for (int i = rawLen; i > 0; i--) { - tmp = Char_.To_int_or(String_.CharAt(raw, i - 1), Int_.Min_value); + tmp = Char_.To_digit_or(String_.CharAt(raw, i - 1), Int_.Min_value); if (tmp == Int_.Min_value) return or; rv += (tmp * factor); factor *= 10; diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpArray.java b/400_xowa/src/gplx/xowa/mediawiki/XophpArray.java index 677672598..3766c6c8c 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpArray.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpArray.java @@ -15,13 +15,44 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt */ package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; import gplx.core.brys.*; +// NOTE: Object-representation of PHP Array; REF.PHP: https://www.php.net/manual/en/language.types.array.php +// Will also will have static functions but "array_" will be stripped; REF.PHP: https://www.php.net/manual/en/ref.array.php public class XophpArray implements Bry_bfr_able { private final Ordered_hash hash = Ordered_hash_.New(); private int nxt_idx; - public int Len() {return hash.Len();} - // TODO: lowercase count - public int Count() {return hash.Len();} - public boolean Count_bool() {return hash.Len() > 0;} + public int count() {return hash.Len();} + public boolean count_bool() {return hash.Len() > 0;} + public boolean isset(String key) {return hash.Has(key);} + public boolean isset(int idx) {return idx >= 0 && idx < hash.Count();} + public boolean in_array(String v) {return Has(v);} + public static boolean is_array(Object val) { + return Type_.Eq_by_obj(val, XophpArray.class); + } + public Object end() { + int len = hash.Len(); + return len == 0 ? null : ((XophpArrayItm)hash.Get_at(len - 1)).Val(); + } + public void unset(int key) {unset(Int_.To_str(key));} + public void unset(String key) { + hash.Del(key); + } + public Object pop() {// "array_pop" + int pos = this.count() - 1; + if (pos < 0) return null; + XophpArrayItm itm = (XophpArrayItm)hash.Get_at(pos); + this.Del_at(pos); + return itm.Val(); + } + // REF.PHP: https://www.php.net/manual/en/function.array-values.php + public XophpArray values() { + XophpArray rv = new XophpArray(); + int len = this.count(); + for (int i = 0; i < len; i++) { + rv.Add(i, this.Get_at(i)); + } + return rv; + } + public void Clear() { hash.Clear(); nxt_idx = 0; @@ -106,18 +137,10 @@ public class XophpArray implements Bry_bfr_able { public void Set(String key, Object val) { this.Set(XophpArrayItm.New_str(key, val)); } - // TODO: lowercase unset - public void Unset(int key) {Unset(Int_.To_str(key));} - public void Unset(String key) { - hash.Del(key); - } - public boolean in_array(String v) {return Has(v);} public boolean Has_obj(Object key) {return Has(Object_.Xto_str_strict_or_null(key));} public boolean Has(String key) { return hash.Has(key); } - public boolean isset(String key) {return hash.Has(key);} - public boolean isset(int idx) {return idx >= 0 && idx < hash.Count();} public XophpArrayItm[] To_ary() { return (XophpArrayItm[])hash.To_ary(XophpArrayItm.class); } @@ -142,15 +165,6 @@ public class XophpArray implements Bry_bfr_able { cur.Val_(itm.Val()); } } - public Object pop() {return Pop();} - // TODO: remove uppercase Pop - public Object Pop() { - int pos = this.Count() - 1; - if (pos < 0) return null; - XophpArrayItm itm = (XophpArrayItm)hash.Get_at(pos); - this.Del_at(pos); - return itm.Val(); - } public void Itm_str_concat_end(int idx, String v) { String itm = (String)this.Get_at(idx); itm += v; @@ -171,12 +185,5 @@ public class XophpArray implements Bry_bfr_able { rv.Add(val); return rv; } - public static boolean is_array(Object val) { - return Type_.Eq_by_obj(val, XophpArray.class); - } - public Object end() { - int len = hash.Len(); - return len == 0 ? null : ((XophpArrayItm)hash.Get_at(len - 1)).Val(); - } public static final XophpArray False = null; // handles code like "if ($var === false)" where var is an Object; } diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpArrayUtl.java b/400_xowa/src/gplx/xowa/mediawiki/XophpArray_.java similarity index 83% rename from 400_xowa/src/gplx/xowa/mediawiki/XophpArrayUtl.java rename to 400_xowa/src/gplx/xowa/mediawiki/XophpArray_.java index 5a9f65684..357446b56 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpArrayUtl.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpArray_.java @@ -14,59 +14,7 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt */ package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; -public class XophpArrayUtl { - public static boolean popBoolOrN(List_adp list) {return Bool_.Cast(List_adp_.Pop_or(list, false));} - public static byte[] popBryOrNull(List_adp list) {return (byte[])List_adp_.Pop_or(list, null);} - public static Object pop_obj(XophpArray array) { - int array_count = array.Count(); - if (array_count == 0) return null; - Object rv = array.Get_at(array_count - 1); - array.Del_at(array_count - 1); - return rv; - } - public static boolean isset(XophpArray ary, int idx) { - return ary.Get_at(idx) != null; - } - public static String[] array_keys_str(Ordered_hash array) { - int len = array.Len(); - String[] rv = new String[len]; - for (int i = 0; i < len; i++) { - rv[i] = (String)array.Get_at(i); - } - return rv; - } - public static byte[][] array_keys_bry(Ordered_hash array) { - int len = array.Len(); - byte[][] rv = new byte[len][]; - for (int i = 0; i < len; i++) { - rv[i] = (byte[])array.Get_at(i); - } - return rv; - } - public static boolean array_key_exists(int key, Ordered_hash array) {return array.Has(key);} - public static boolean array_key_exists(String key, Ordered_hash array) {return array.Has(key);} - public static boolean array_key_exists(byte[] key, Ordered_hash array) {return array.Has(key);} - public static boolean array_is_empty(Ordered_hash array) { - return array.Len() == 0; - } - public static void unset(Ordered_hash array, Object key) { - array.Del(key); - } - public static Object[] unset_by_idx(Object[] ary, int idx) { - int ary_len = ary.length; - Object[] rv = new Object[ary_len]; - for (int i = 0; i < idx; i++) - rv[i] = ary[i]; - for (int i = idx + 1; i < ary_len; i++) - rv[i - 1] = ary[i]; - return rv; - } - public static boolean in_array(String needle, String[] haystack) { - for (String hay : haystack) - if (String_.Eq(hay, needle)) - return true; - return false; - } +public class XophpArray_ { public static XophpArray array_merge(XophpArray... vals) { XophpArray rv = new XophpArray(); for (XophpArray ary : vals) { @@ -83,11 +31,11 @@ public class XophpArrayUtl { else ary.Add(itm.Key(), itm.Val()); } - public static XophpArray array_splice(XophpArray src, int bgn) {return array_splice(src, bgn, src.Len(), null);} + public static XophpArray array_splice(XophpArray src, int bgn) {return array_splice(src, bgn, src.count(), null);} public static XophpArray array_splice(XophpArray src, int bgn, int len) {return array_splice(src, bgn, len , null);} public static XophpArray array_splice(XophpArray src, int bgn, int len, XophpArray repl) { // get itms before clearing it - int src_len = src.Len(); + int src_len = src.count(); XophpArrayItm[] itms = src.To_ary(); src.Clear(); @@ -141,7 +89,7 @@ public class XophpArrayUtl { return rv; } // ( array $array , int $offset [, int $length = NULL [, boolean $preserve_keys = FALSE ]] ) : - public static XophpArray array_slice(XophpArray array, int offset) {return array_slice(array, offset, array.Len());} + public static XophpArray array_slice(XophpArray array, int offset) {return array_slice(array, offset, array.count());} public static XophpArray array_slice(XophpArray array, int offset, int length) { XophpArray rv = new XophpArray(); int end = offset + length; @@ -151,13 +99,47 @@ public class XophpArrayUtl { return rv; } - // REF.PHP: https://www.php.net/manual/en/function.array-values.php - public static XophpArray array_values(XophpArray array) { - XophpArray rv = new XophpArray(); + // DEPRECATE:use XophpArray + public static boolean popBoolOrN(List_adp list) {return Bool_.Cast(List_adp_.Pop_or(list, false));} + public static byte[] popBryOrNull(List_adp list) {return (byte[])List_adp_.Pop_or(list, null);} + public static String[] array_keys_str(Ordered_hash array) { int len = array.Len(); + String[] rv = new String[len]; for (int i = 0; i < len; i++) { - rv.Add(i, array.Get_at(i)); + rv[i] = (String)array.Get_at(i); } return rv; } + public static byte[][] array_keys_bry(Ordered_hash array) { + int len = array.Len(); + byte[][] rv = new byte[len][]; + for (int i = 0; i < len; i++) { + rv[i] = (byte[])array.Get_at(i); + } + return rv; + } + public static boolean array_key_exists(int key, Ordered_hash array) {return array.Has(key);} + public static boolean array_key_exists(String key, Ordered_hash array) {return array.Has(key);} + public static boolean array_key_exists(byte[] key, Ordered_hash array) {return array.Has(key);} + public static boolean array_is_empty(Ordered_hash array) { + return array.Len() == 0; + } + public static void unset(Ordered_hash array, Object key) { + array.Del(key); + } + public static Object[] unset_by_idx(Object[] ary, int idx) { + int ary_len = ary.length; + Object[] rv = new Object[ary_len]; + for (int i = 0; i < idx; i++) + rv[i] = ary[i]; + for (int i = idx + 1; i < ary_len; i++) + rv[i - 1] = ary[i]; + return rv; + } + public static boolean in_array(String needle, String[] haystack) { + for (String hay : haystack) + if (String_.Eq(hay, needle)) + return true; + return false; + } } diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpArrayUtl_tst.java b/400_xowa/src/gplx/xowa/mediawiki/XophpArray__tst.java similarity index 81% rename from 400_xowa/src/gplx/xowa/mediawiki/XophpArrayUtl_tst.java rename to 400_xowa/src/gplx/xowa/mediawiki/XophpArray__tst.java index c51126cc2..5e73e1d60 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpArrayUtl_tst.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpArray__tst.java @@ -15,8 +15,8 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt */ package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; import org.junit.*; import gplx.core.tests.*; -public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.array-merge.php - private final XophpArrayUtl_fxt fxt = new XophpArrayUtl_fxt(); +public class XophpArray__tst { // REF:https://www.php.net/manual/en/function.array-merge.php + private final XophpArray__fxt fxt = new XophpArray__fxt(); @Test public void array_merge__basic() { XophpArray ary1 = fxt.Make().Add("key1", "val1").Add("a"); XophpArray ary2 = fxt.Make().Add("key2", "val2").Add("b"); @@ -61,7 +61,7 @@ public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.a } @Test public void array_splice__bgn_is_positive() { XophpArray src = fxt.Make().Add_many("a", "b", "c", "d"); - XophpArray del = XophpArrayUtl.array_splice(src, 1); + XophpArray del = XophpArray_.array_splice(src, 1); fxt.Test__eq ( fxt.Make().Add_many("a") , src @@ -73,7 +73,7 @@ public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.a } @Test public void array_splice__bgn_is_positive_large() { XophpArray src = fxt.Make().Add_many("a", "b", "c", "d"); - XophpArray del = XophpArrayUtl.array_splice(src, 99); + XophpArray del = XophpArray_.array_splice(src, 99); fxt.Test__eq ( fxt.Make().Add_many("a", "b", "c", "d") , src @@ -85,7 +85,7 @@ public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.a } @Test public void array_splice__bgn_is_negative() { XophpArray src = fxt.Make().Add_many("a", "b", "c", "d"); - XophpArray del = XophpArrayUtl.array_splice(src, -3); + XophpArray del = XophpArray_.array_splice(src, -3); fxt.Test__eq ( fxt.Make().Add_many("a") , src @@ -97,7 +97,7 @@ public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.a } @Test public void array_splice__bgn_is_negative_large() { XophpArray src = fxt.Make().Add_many("a", "b", "c", "d"); - XophpArray del = XophpArrayUtl.array_splice(src, -99); + XophpArray del = XophpArray_.array_splice(src, -99); fxt.Test__eq ( fxt.Make() , src @@ -109,7 +109,7 @@ public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.a } @Test public void array_splice__len_is_positive() { XophpArray src = fxt.Make().Add_many("a", "b", "c", "d"); - XophpArray del = XophpArrayUtl.array_splice(src, 1, 2); + XophpArray del = XophpArray_.array_splice(src, 1, 2); fxt.Test__eq ( fxt.Make().Add_many("a", "d") , src @@ -121,7 +121,7 @@ public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.a } @Test public void array_splice__len_is_positive_large() { XophpArray src = fxt.Make().Add_many("a", "b", "c", "d"); - XophpArray del = XophpArrayUtl.array_splice(src, 1, 99); + XophpArray del = XophpArray_.array_splice(src, 1, 99); fxt.Test__eq ( fxt.Make().Add_many("a") , src @@ -133,7 +133,7 @@ public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.a } @Test public void array_splice__len_is_negative() { XophpArray src = fxt.Make().Add_many("a", "b", "c", "d"); - XophpArray del = XophpArrayUtl.array_splice(src, 1, -2); + XophpArray del = XophpArray_.array_splice(src, 1, -2); fxt.Test__eq ( fxt.Make().Add_many("a", "c", "d") , src @@ -145,7 +145,7 @@ public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.a } @Test public void array_splice__len_is_negative_large() { XophpArray src = fxt.Make().Add_many("a", "b", "c", "d"); - XophpArray del = XophpArrayUtl.array_splice(src, 1, -99); + XophpArray del = XophpArray_.array_splice(src, 1, -99); fxt.Test__eq ( fxt.Make().Add_many("a", "b", "c", "d") , src @@ -157,7 +157,7 @@ public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.a } @Test public void array_splice__repl() { XophpArray src = fxt.Make().Add(0, "a").Add(1, "b").Add(2, "c").Add(3, "d"); - XophpArray del = XophpArrayUtl.array_splice(src, 1, 2, fxt.Make().Add(0, "x")); + XophpArray del = XophpArray_.array_splice(src, 1, 2, fxt.Make().Add(0, "x")); fxt.Test__eq ( fxt.Make().Add(0, "a").Add(1, "x").Add(2, "d") , src @@ -169,7 +169,7 @@ public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.a } @Test public void array_splice__example_1a() { XophpArray src = fxt.Make().Add_many("red", "green", "blue", "yellow"); - XophpArray del = XophpArrayUtl.array_splice(src, 2); + XophpArray del = XophpArray_.array_splice(src, 2); fxt.Test__eq ( fxt.Make().Add_many("red", "green") , src @@ -181,7 +181,7 @@ public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.a } @Test public void array_splice__example_1b() { XophpArray src = fxt.Make().Add_many("red", "green", "blue", "yellow"); - XophpArray del = XophpArrayUtl.array_splice(src, 1, -1); + XophpArray del = XophpArray_.array_splice(src, 1, -1); fxt.Test__eq ( fxt.Make().Add_many("red", "yellow") , src @@ -193,7 +193,7 @@ public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.a } @Test public void array_splice__example_1c() { XophpArray src = fxt.Make().Add_many("red", "green", "blue", "yellow"); - XophpArray del = XophpArrayUtl.array_splice(src, 1, 4, XophpArray.New("orange")); + XophpArray del = XophpArray_.array_splice(src, 1, 4, XophpArray.New("orange")); fxt.Test__eq ( fxt.Make().Add_many("red", "orange") , src @@ -205,7 +205,7 @@ public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.a } @Test public void array_splice__example_1d() { XophpArray src = fxt.Make().Add_many("red", "green", "blue", "yellow"); - XophpArray del = XophpArrayUtl.array_splice(src, -1, 1, XophpArray.New("black", "maroon")); + XophpArray del = XophpArray_.array_splice(src, -1, 1, XophpArray.New("black", "maroon")); fxt.Test__eq ( fxt.Make().Add_many("red", "green", "blue", "black", "maroon") , src @@ -215,18 +215,18 @@ public class XophpArrayUtl_tst { // REF:https://www.php.net/manual/en/function.a , del ); } - @Test public void array_values() { + @Test public void values() { XophpArray orig = fxt.Make().Add("size", "XL").Add("color", "gold"); fxt.Test__eq ( fxt.Make().Add(0, "XL").Add(1, "gold") - , XophpArrayUtl.array_values(orig) + , orig.values() ); } } -class XophpArrayUtl_fxt { +class XophpArray__fxt { public XophpArray Make() {return new XophpArray();} public void Test__array_merge(XophpArray expd, XophpArray... vals) { - XophpArray actl = XophpArrayUtl.array_merge(vals); + XophpArray actl = XophpArray_.array_merge(vals); Gftest.Eq__str(expd.To_str(), actl.To_str()); } public void Test__eq(XophpArray expd, XophpArray actl) { diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpArray_tst.java b/400_xowa/src/gplx/xowa/mediawiki/XophpArray_tst.java index 25948f0df..655edcd8f 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpArray_tst.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpArray_tst.java @@ -112,8 +112,8 @@ public class XophpArray_tst { // REF: http://php.net/manual/en/language.types.ar ary.Add(0, "a").Add(1, "b"); // delete all - ary.Unset(0); - ary.Unset(1); + ary.unset(0); + ary.unset(1); fxt.Test__array(ary); // add new and assert idx is 2 @@ -156,7 +156,7 @@ public class XophpArray_tst { // REF: http://php.net/manual/en/language.types.ar } class XophpArray_fxt { public void Test__Count(XophpArray ary, int expd) { - Gftest.Eq__int(expd, ary.Count()); + Gftest.Eq__int(expd, ary.count()); } public void Test__array(XophpArray ary, XophpArrayItm... expd) { XophpArrayItm[] actl = ary.To_ary(); @@ -167,7 +167,7 @@ class XophpArray_fxt { Gftest.Eq__ary(expd, actl); } public void Test__Pop(XophpArray ary, String expd) { - String actl = (String)ary.Pop(); + String actl = (String)ary.pop(); Gftest.Eq__str(expd, actl); } public void Test__Itm_str_concat_end(XophpArray ary, String expd, int idx, String v) { diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpBool.java b/400_xowa/src/gplx/xowa/mediawiki/XophpBool_.java similarity index 96% rename from 400_xowa/src/gplx/xowa/mediawiki/XophpBool.java rename to 400_xowa/src/gplx/xowa/mediawiki/XophpBool_.java index 6f774e539..1f51dd3ca 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpBool.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpBool_.java @@ -14,7 +14,7 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt */ package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; -public class XophpBool { +public class XophpBool_ { public static boolean is_true(byte[] val) {return val != null && is_true(String_.new_u8(val));} public static boolean is_true(String val) { // REF: https://www.php.net/manual/en/language.types.boolean.php#language.types.boolean.casting diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpBool_tst.java b/400_xowa/src/gplx/xowa/mediawiki/XophpBool__tst.java similarity index 81% rename from 400_xowa/src/gplx/xowa/mediawiki/XophpBool_tst.java rename to 400_xowa/src/gplx/xowa/mediawiki/XophpBool__tst.java index c18a3043e..ff5236742 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpBool_tst.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpBool__tst.java @@ -15,21 +15,21 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt */ package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; import org.junit.*; import gplx.core.tests.*; -public class XophpBool_tst { - private final XophpBool_fxt fxt = new XophpBool_fxt(); +public class XophpBool__tst { + private final XophpBool__fxt fxt = new XophpBool__fxt(); @Test public void is_true() { fxt.Test__is_true_bry(Bool_.N, null); fxt.Test__is_true_str(Bool_.N, null, "", "False", "0", "-0", "0.0", "-0.0"); fxt.Test__is_true_str(Bool_.Y, "a", "0.1"); } } -class XophpBool_fxt { +class XophpBool__fxt { public void Test__is_true_str(boolean expd, String... ary) { for (String itm : ary) { - Gftest.Eq__bool(expd, XophpBool.is_true(itm)); + Gftest.Eq__bool(expd, XophpBool_.is_true(itm)); } } public void Test__is_true_bry(boolean expd, byte[] itm) { - Gftest.Eq__bool(expd, XophpBool.is_true(itm)); + Gftest.Eq__bool(expd, XophpBool_.is_true(itm)); } } diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpBry_.java b/400_xowa/src/gplx/xowa/mediawiki/XophpBry_.java deleted file mode 100644 index b724aae26..000000000 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpBry_.java +++ /dev/null @@ -1,19 +0,0 @@ -/* -XOWA: the XOWA Offline Wiki Application -Copyright (C) 2012-2017 gnosygnu@gmail.com - -XOWA is licensed under the terms of the General Public License (GPL) Version 3, -or alternatively under the terms of the Apache License Version 2.0. - -You may use XOWA according to either of these licenses as is most appropriate -for your project on a case-by-case basis. - -The terms of each license can be found in the source code repository: - -GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt -Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt -*/ -package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; -public class XophpBry_ { - public static final byte[] False = null; // handles code like "if ($var === false)" where var is an Object; -} diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpEncode.java b/400_xowa/src/gplx/xowa/mediawiki/XophpEncode_.java similarity index 95% rename from 400_xowa/src/gplx/xowa/mediawiki/XophpEncode.java rename to 400_xowa/src/gplx/xowa/mediawiki/XophpEncode_.java index ca5ca2d07..f5d58c75a 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpEncode.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpEncode_.java @@ -14,7 +14,7 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt */ package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; -public class XophpEncode { +public class XophpEncode_ { public static byte[] rawurlencode(byte[] v) { return gplx.langs.htmls.encoders.Gfo_url_encoder_.Php_rawurlencode.Encode(v); } diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpInt_.java b/400_xowa/src/gplx/xowa/mediawiki/XophpInt_.java index cb1dcf292..708673d24 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpInt_.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpInt_.java @@ -15,7 +15,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt */ package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; public class XophpInt_ { - public static final int False = -1; // handles code like "if ($var === false)" where var is an Object; + public static boolean is_true(int val) {return val != -1;} // handles code like "if ($var === false)" where var is an Object; public static String strval(int number) { return Int_.To_str(number); } diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpMath.java b/400_xowa/src/gplx/xowa/mediawiki/XophpMath_.java similarity index 90% rename from 400_xowa/src/gplx/xowa/mediawiki/XophpMath.java rename to 400_xowa/src/gplx/xowa/mediawiki/XophpMath_.java index 2a5179fe6..1d77a88a3 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpMath.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpMath_.java @@ -14,7 +14,7 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt */ package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; -public class XophpMath { +public class XophpMath_ { public static double round(double v, int places) { if (places < 0) { // -1 means round to 10; -2 means round to 100; etc.. int factor = (int)Math_.Pow(10, places * -1); @@ -48,14 +48,4 @@ public class XophpMath { public static double fmod(double lhs, double rhs) { return (double)lhs % (double)rhs; } - -/* - -fmod - -$x = 5.7; -$y = 1.3; -$r = fmod($x, $y); -// $r equals 0.5, because 4 * 1.3 + 0.5 = 5.7 -*/ } diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpMath__tst.java b/400_xowa/src/gplx/xowa/mediawiki/XophpMath__tst.java index fa001ba7a..fa9bbc184 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpMath__tst.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpMath__tst.java @@ -25,6 +25,6 @@ public class XophpMath__tst { } class XophpMath__fxt { public void Test__fmod(double lhs, double rhs, double expd) { - Gftest.Eq__double(expd, XophpMath.fmod(lhs, rhs)); + Gftest.Eq__double(expd, XophpMath_.fmod(lhs, rhs)); } } diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpObject.java b/400_xowa/src/gplx/xowa/mediawiki/XophpObject.java deleted file mode 100644 index 227b17fb5..000000000 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpObject.java +++ /dev/null @@ -1,22 +0,0 @@ -/* -XOWA: the XOWA Offline Wiki Application -Copyright (C) 2012-2017 gnosygnu@gmail.com - -XOWA is licensed under the terms of the General Public License (GPL) Version 3, -or alternatively under the terms of the Apache License Version 2.0. - -You may use XOWA according to either of these licenses as is most appropriate -for your project on a case-by-case basis. - -The terms of each license can be found in the source code repository: - -GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt -Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt -*/ -package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; -public class XophpObject { - public static final Object False = null; // handles code like "if ($var === false)" where var is an Object; - public static boolean is_true(Object val) {return val != null;} - public static boolean is_null(Object val) {return val == null;} - public static Object coalesce(Object val, Object if_null) {return val == null ? if_null : val;} -} diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpUtility.java b/400_xowa/src/gplx/xowa/mediawiki/XophpObject_.java similarity index 86% rename from 400_xowa/src/gplx/xowa/mediawiki/XophpUtility.java rename to 400_xowa/src/gplx/xowa/mediawiki/XophpObject_.java index 751e85ff3..a1f6627f4 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpUtility.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpObject_.java @@ -14,7 +14,11 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt */ package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; -public class XophpUtility { +public class XophpObject_ { + public static final Object False = null; // handles code like "if ($var === false)" where var is an Object; + public static boolean is_true(Object val) {return val != null;} + public static boolean is_null(Object val) {return val == null;} + // REF.PHP:http://php.net/manual/en/function.empty.php public static boolean empty(String v) {return v == null || String_.Len_eq_0(v);} public static boolean empty(byte[] v) {return v == null || v.length == 0;} @@ -76,4 +80,5 @@ public class XophpUtility { public static final int NULL_INT = Int_.Max_value; public static final double NULL_DOUBLE = Double_.MinValue; public static final byte[] NULL_BRY = null; + public static Object coalesce(Object val, Object if_null) {return val == null ? if_null : val;} } diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpUtility_tst.java b/400_xowa/src/gplx/xowa/mediawiki/XophpObject__tst.java similarity index 88% rename from 400_xowa/src/gplx/xowa/mediawiki/XophpUtility_tst.java rename to 400_xowa/src/gplx/xowa/mediawiki/XophpObject__tst.java index 94708007a..28b63f89b 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpUtility_tst.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpObject__tst.java @@ -15,8 +15,8 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt */ package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; import org.junit.*; import gplx.core.tests.*; -public class XophpUtility_tst { - private final XophpUtility_fxt fxt = new XophpUtility_fxt(); +public class XophpObject__tst { + private final XophpObject__fxt fxt = new XophpObject__fxt(); @Test public void Empty_obj() { fxt.Test_empty_obj_y(""); // "" (an empty String) fxt.Test_empty_obj_y(0); // 0 (0 as an integer) @@ -35,10 +35,10 @@ public class XophpUtility_tst { fxt.Test_empty_obj_n(new int[1]); } } -class XophpUtility_fxt { +class XophpObject__fxt { public void Test_empty_obj_n(Object o) {Test_empty_obj(Bool_.N, o);} public void Test_empty_obj_y(Object o) {Test_empty_obj(Bool_.Y, o);} public void Test_empty_obj(boolean expd, Object o) { - Gftest.Eq__bool(expd, XophpUtility.empty_obj(o), Object_.Xto_str_strict_or_empty(o)); + Gftest.Eq__bool(expd, XophpObject_.empty_obj(o), Object_.Xto_str_strict_or_empty(o)); } } diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpPreg.java b/400_xowa/src/gplx/xowa/mediawiki/XophpPreg_.java similarity index 96% rename from 400_xowa/src/gplx/xowa/mediawiki/XophpPreg.java rename to 400_xowa/src/gplx/xowa/mediawiki/XophpPreg_.java index a53a488e1..c2f143813 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpPreg.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpPreg_.java @@ -16,7 +16,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; import gplx.core.btries.*; import gplx.core.brys.*; import gplx.core.primitives.*; -public class XophpPreg { +public class XophpPreg_ { public static byte[][] split(Int_list list, byte[] src, int src_bgn, int src_end, byte[] dlm, boolean extend) { // find delimiters int dlm_len = dlm.length; diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpPreg_tst.java b/400_xowa/src/gplx/xowa/mediawiki/XophpPreg__tst.java similarity index 86% rename from 400_xowa/src/gplx/xowa/mediawiki/XophpPreg_tst.java rename to 400_xowa/src/gplx/xowa/mediawiki/XophpPreg__tst.java index 707d8b3c7..115a8f176 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpPreg_tst.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpPreg__tst.java @@ -15,17 +15,17 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt */ package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; import org.junit.*; import gplx.core.tests.*; -public class XophpPreg_tst { - private final XophpPreg_fxt fxt = new XophpPreg_fxt(); +public class XophpPreg__tst { + private final XophpPreg__fxt fxt = new XophpPreg__fxt(); @Test public void Basic() {fxt.Test_split("a''b''c" , "''", Bool_.Y, "a", "''", "b", "''", "c");} @Test public void Extend() {fxt.Test_split("a'''b'''c" , "''", Bool_.Y, "a", "'''", "b", "'''", "c");} @Test public void Eos() {fxt.Test_split("a''" , "''", Bool_.Y, "a", "''");} } -class XophpPreg_fxt { +class XophpPreg__fxt { private final gplx.core.primitives.Int_list rv = new gplx.core.primitives.Int_list(); public void Test_split(String src, String dlm, boolean extend, String... expd) {Test_split(src, 0, String_.Len(src), dlm, extend, expd);} public void Test_split(String src, int src_bgn, int src_end, String dlm, boolean extend, String... expd) { - byte[][] actl = XophpPreg.split(rv, Bry_.new_u8(src), src_bgn, src_end, Bry_.new_u8(dlm), extend); + byte[][] actl = XophpPreg_.split(rv, Bry_.new_u8(src), src_bgn, src_end, Bry_.new_u8(dlm), extend); Gftest.Eq__ary(expd, String_.Ary(actl), "find_failed"); } } diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpRegex_.java b/400_xowa/src/gplx/xowa/mediawiki/XophpRegex_.java index adafaccdc..db1483fa4 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpRegex_.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpRegex_.java @@ -75,7 +75,7 @@ public class XophpRegex_ { PREG_OFFSET_CAPTURE = 256 , PREG_UNMATCHED_AS_NULL = 0 , PREG_NO_FLAG = Int_.Min_value - , PREG_ERR = XophpInt_.False + , PREG_ERR = -1 ; public static final int NOT_FOUND = 0, FOUND = 1; diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpString_.java b/400_xowa/src/gplx/xowa/mediawiki/XophpString_.java index 56d1e9e8b..69c820838 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpString_.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpString_.java @@ -34,6 +34,7 @@ public class XophpString_ { public static int strpos(byte[] src, byte find, int bgn, int end) { return Bry_find_.Find_fwd(src, find, bgn, end); } + public static int strpos_NULL = -1; // REF.PHP: https://www.php.net/manual/en/function.substr.php public static String substr(String src, int bgn, int len) {return String_.new_u8(substr(Bry_.new_u8(src), bgn, len));} @@ -108,7 +109,6 @@ public class XophpString_ { if (Utf16_.Len_by_char(subject_char) == 2) { i++; char lo_char = String_.CharAt(subject, i); - // TODO: change Char_.To_int_or to Char_.To_digit int surrogate_char = Utf16_.Surrogate_merge(Char_.To_int(subject_char), Char_.To_int(lo_char)); mask_key = String_.new_u8(Utf16_.Encode_int_to_bry(surrogate_char)); } diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpString__tst.java b/400_xowa/src/gplx/xowa/mediawiki/XophpString__tst.java index 64ccde268..e95b99db9 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpString__tst.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpString__tst.java @@ -56,7 +56,7 @@ public class XophpString__tst { } @Test public void Strpos() { fxt.Test__strpos("abc", "b", 0, 1); - fxt.Test__strpos("abc", "z", 0, XophpInt_.False); + fxt.Test__strpos("abc", "z", 0, XophpString_.strpos_NULL); fxt.Test__strpos("aba", "a", 1, 2); fxt.Test__strpos("aba", "a", -2, 2); } diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpType.java b/400_xowa/src/gplx/xowa/mediawiki/XophpType.java index 02931ebfc..759028663 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpType.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpType.java @@ -26,6 +26,6 @@ public class XophpType { return type_id == Type_ids_.Id__array; } public static XophpType New(Object o) { - return new XophpType(XophpTypeUtl.To_type_id(o)); + return new XophpType(XophpType_.To_type_id(o)); } } diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpTypeUtl.java b/400_xowa/src/gplx/xowa/mediawiki/XophpType_.java similarity index 95% rename from 400_xowa/src/gplx/xowa/mediawiki/XophpTypeUtl.java rename to 400_xowa/src/gplx/xowa/mediawiki/XophpType_.java index dca17fb21..45e4c65dd 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpTypeUtl.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpType_.java @@ -14,7 +14,7 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt */ package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; -public class XophpTypeUtl { +public class XophpType_ { public static int To_type_id(Object o) { int type_id = Type_ids_.To_id_by_obj(o); switch (type_id) { diff --git a/400_xowa/src/gplx/xowa/mediawiki/XophpUrl.java b/400_xowa/src/gplx/xowa/mediawiki/XophpUrl_.java similarity index 96% rename from 400_xowa/src/gplx/xowa/mediawiki/XophpUrl.java rename to 400_xowa/src/gplx/xowa/mediawiki/XophpUrl_.java index 7bfc0476c..1234efdb8 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/XophpUrl.java +++ b/400_xowa/src/gplx/xowa/mediawiki/XophpUrl_.java @@ -15,7 +15,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt */ package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*; import gplx.core.net.*; -public class XophpUrl { +public class XophpUrl_ { public static final int PHP_URL_SCHEME = 0 , PHP_URL_HOST = 3 diff --git a/400_xowa/src/gplx/xowa/mediawiki/extensions/JsonConfig/includes/JCValue.java b/400_xowa/src/gplx/xowa/mediawiki/extensions/JsonConfig/includes/JCValue.java index 937253ff8..525550a50 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/extensions/JsonConfig/includes/JCValue.java +++ b/400_xowa/src/gplx/xowa/mediawiki/extensions/JsonConfig/includes/JCValue.java @@ -181,9 +181,9 @@ public class JCValue { else if (value_tid == Value_tid__ary && (fld_type == Type_ids_.Id__str || fld_type == Type_ids_.Id__int)) { tmp = value_as_ary.Get_by_obj(fld); if (fld_type == Type_ids_.Id__str) - value_as_ary.Unset((String)fld); + value_as_ary.unset((String)fld); else - value_as_ary.Unset(Int_.Cast(fld)); + value_as_ary.unset(Int_.Cast(fld)); value.Del(fld); } else { diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/XomwLinker.java b/400_xowa/src/gplx/xowa/mediawiki/includes/XomwLinker.java index 861829821..98ab88038 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/XomwLinker.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/XomwLinker.java @@ -341,16 +341,16 @@ public class XomwLinker { // Clean up parameters int page = handlerParams.page; - if (!XophpUtility.isset(frameParams.align)) { + if (!XophpObject_.isset(frameParams.align)) { frameParams.align = Bry_.Empty; } - if (!XophpUtility.isset(frameParams.alt)) { + if (!XophpObject_.isset(frameParams.alt)) { frameParams.alt = Bry_.Empty; } - if (!XophpUtility.isset(frameParams.title)) { + if (!XophpObject_.isset(frameParams.title)) { frameParams.title = Bry_.Empty; } - if (!XophpUtility.isset(frameParams.cls)) { + if (!XophpObject_.isset(frameParams.cls)) { frameParams.cls = Bry_.Empty; } @@ -361,8 +361,8 @@ public class XomwLinker { postfix = Gfh_tag_.Div_rhs; frameParams.align = Align__frame__none; } - if (file != null && !XophpUtility.isset(handlerParams.width)) { - if (XophpUtility.isset(handlerParams.height) && file.isVectorized()) { + if (file != null && !XophpObject_.isset(handlerParams.width)) { + if (XophpObject_.isset(handlerParams.height) && file.isVectorized()) { // If its a vector image, and user only specifies height // we don't want it to be limited by its "normal" width. handlerParams.width = env.Global__wgSVGMaxSize; @@ -371,13 +371,13 @@ public class XomwLinker { handlerParams.width = file.getWidth(page); } - if ( XophpUtility.isset(frameParams.thumbnail) - || XophpUtility.isset(frameParams.manualthumb) - || XophpUtility.isset(frameParams.framed) - || XophpUtility.isset(frameParams.frameless) - || !XophpUtility.istrue(handlerParams.width) + if ( XophpObject_.isset(frameParams.thumbnail) + || XophpObject_.isset(frameParams.manualthumb) + || XophpObject_.isset(frameParams.framed) + || XophpObject_.isset(frameParams.frameless) + || !XophpObject_.istrue(handlerParams.width) ) { - if (widthOption == XophpUtility.NULL_INT) { // XO.MW: MW does extra validation that widthOption is in array; ("!isset( $wgThumbLimits[$widthOption] )") + if (widthOption == XophpObject_.NULL_INT) { // XO.MW: MW does extra validation that widthOption is in array; ("!isset( $wgThumbLimits[$widthOption] )") widthOption = env.User__default__thumbsize; } @@ -389,13 +389,13 @@ public class XomwLinker { // For caching health: If width scaled down due to upright // parameter, round to full __0 pixel to avoid the creation of a // lot of odd thumbs. - int prefWidth = XophpUtility.isset(frameParams.upright) ? - (int)XophpMath.round(widthOption * frameParams.upright, -1) : + int prefWidth = XophpObject_.isset(frameParams.upright) ? + (int)XophpMath_.round(widthOption * frameParams.upright, -1) : widthOption; // Use width which is smaller: real image width or user preference width // Unless image is scalable vector. - if (handlerParams.height == XophpUtility.NULL_INT && handlerParams.width <= 0 || + if (handlerParams.height == XophpObject_.NULL_INT && handlerParams.width <= 0 || prefWidth < handlerParams.width || file.isVectorized()) { handlerParams.width = prefWidth; } @@ -424,13 +424,13 @@ public class XomwLinker { // For "frameless" option: do not present an image bigger than the // source (for bitmap-style images). This is the same behavior as the // "thumb" option does it already. - if (XophpUtility.istrue(srcWidth) && !file.mustRender() && handlerParams.width > srcWidth) { + if (XophpObject_.istrue(srcWidth) && !file.mustRender() && handlerParams.width > srcWidth) { handlerParams.width = srcWidth; } } XomwMediaTransformOutput thumb = null; - if (file != null && XophpUtility.isset(handlerParams.width)) { + if (file != null && XophpObject_.isset(handlerParams.width)) { // Create a resized image, without the additional thumbnail features thumb = file.transform(handlerParams); } @@ -481,9 +481,9 @@ public class XomwLinker { // @return array // XO.MW:SYNC:1.29; DATE:2017-02-08 private static void getImageLinkMTOParams(Xomw_params_mto rv, Xomw_params_frame frameParams, byte[] query, XomwParserIface parser) { - if (XophpUtility.isset(frameParams.link_url) && frameParams.link_url != Bry_.Empty) { + if (XophpObject_.isset(frameParams.link_url) && frameParams.link_url != Bry_.Empty) { rv.custom_url_link = frameParams.link_url; - if (XophpUtility.isset(frameParams.link_target)) { + if (XophpObject_.isset(frameParams.link_target)) { rv.custom_target_link = frameParams.link_target; } if (parser != null) { @@ -494,10 +494,10 @@ public class XomwLinker { // } } } - else if (XophpUtility.isset(frameParams.link_title) && frameParams.link_title != Bry_.Empty) { + else if (XophpObject_.isset(frameParams.link_title) && frameParams.link_title != Bry_.Empty) { // rv.custom_title_link = Title::newFromLinkTarget(Normalize_speecial_page(frameParams.link_title)); } - else if (!XophpUtility.empty(frameParams.no_link)) { + else if (!XophpObject_.empty(frameParams.no_link)) { // No link } else { @@ -538,22 +538,22 @@ public class XomwLinker { boolean exists = file != null && file.exists(); int page = handlerParams.page; - if (!XophpUtility.isset(frameParams.align)) { + if (!XophpObject_.isset(frameParams.align)) { frameParams.align = Align__frame__right; } - if (!XophpUtility.isset(frameParams.alt)) { + if (!XophpObject_.isset(frameParams.alt)) { frameParams.alt = Bry_.Empty; } - if (!XophpUtility.isset(frameParams.title)) { + if (!XophpObject_.isset(frameParams.title)) { frameParams.title = Bry_.Empty; } - if (!XophpUtility.isset(frameParams.caption)) { + if (!XophpObject_.isset(frameParams.caption)) { frameParams.caption = Bry_.Empty; } - if (XophpUtility.empty(handlerParams.width)) { + if (XophpObject_.empty(handlerParams.width)) { // Reduce width for upright images when parameter 'upright' is used - handlerParams.width = XophpUtility.isset(frameParams.upright) ? 130 : 180; + handlerParams.width = XophpObject_.isset(frameParams.upright) ? 130 : 180; } XomwMediaTransformOutput thumb = null; boolean noscale = false; @@ -564,7 +564,7 @@ public class XomwLinker { outerWidth = handlerParams.width + 2; } else { - if (XophpUtility.isset(frameParams.manualthumb)) { + if (XophpObject_.isset(frameParams.manualthumb)) { // Use manually specified thumbnail // $manual_title = Title::makeTitleSafe(NS_FILE, frameParams['manualthumb']); // if ($manual_title) { @@ -577,7 +577,7 @@ public class XomwLinker { // } // } } - else if (XophpUtility.isset(frameParams.framed)) { + else if (XophpObject_.isset(frameParams.framed)) { // Use image dimensions, don't scale // thumb = $file->getUnscaledThumb(handlerParams); thumb = new XomwThumbnailImage(file, file.getUrl(), file.getUrl(), file.getWidth(), file.getHeight()); @@ -587,7 +587,7 @@ public class XomwLinker { // Do not present an image bigger than the source, for bitmap-style images // This is a hack to maintain compatibility with arbitrary pre-1.10 behavior int srcWidth = file.getWidth(page); - if (XophpUtility.istrue(srcWidth) && !file.mustRender() && handlerParams.width > srcWidth) { + if (XophpObject_.istrue(srcWidth) && !file.mustRender() && handlerParams.width > srcWidth) { handlerParams.width = srcWidth; } thumb = file.transform(handlerParams); @@ -610,9 +610,9 @@ public class XomwLinker { // $url = wfAppendQuery($url, [ 'page' => $page ]); // } if (manualthumb - && !XophpUtility.isset(frameParams.link_title) - && !XophpUtility.isset(frameParams.link_url) - && !XophpUtility.isset(frameParams.no_link) + && !XophpObject_.isset(frameParams.link_title) + && !XophpObject_.isset(frameParams.link_url) + && !XophpObject_.isset(frameParams.no_link) ) { frameParams.link_url = url; } @@ -642,7 +642,7 @@ public class XomwLinker { getImageLinkMTOParams(prms, frameParams, query, null); thumb.toHtml(bfr, tmp, prms); - if (XophpUtility.isset(frameParams.framed)) { + if (XophpObject_.isset(frameParams.framed)) { zoom_icon = Bry_.Empty; } else { diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/XomwNamespace.java b/400_xowa/src/gplx/xowa/mediawiki/includes/XomwNamespace.java index 70cb8fd55..5b3a1e90d 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/XomwNamespace.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/XomwNamespace.java @@ -500,5 +500,5 @@ public class XomwNamespace { // // return $usableLevels; // } - public static final int NULL_NS_ID = XophpUtility.NULL_INT; + public static final int NULL_NS_ID = XophpObject_.NULL_INT; } diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/XomwNamespacesByName.java b/400_xowa/src/gplx/xowa/mediawiki/includes/XomwNamespacesByName.java index 984635a7c..597f440dd 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/XomwNamespacesByName.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/XomwNamespacesByName.java @@ -19,7 +19,7 @@ public class XomwNamespacesByName { public int Len() {return hash.Len();} public int GetAsIdOrNullInt(byte[] name) { XomwNamespaceItem item = (XomwNamespaceItem)hash.Get_by(name); - return item == null ? XophpUtility.NULL_INT : item.id; + return item == null ? XophpObject_.NULL_INT : item.id; } public XomwNamespaceItem GetAtOrNull(int idx) { return (XomwNamespaceItem)hash.Get_at(idx); diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/XomwSanitizer.java b/400_xowa/src/gplx/xowa/mediawiki/includes/XomwSanitizer.java index 3ce0cf096..4597b0fa8 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/XomwSanitizer.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/XomwSanitizer.java @@ -1233,7 +1233,7 @@ public class XomwSanitizer { // ' ', // $text); normalizeWhitespaceBry.Init(text, 0, text.length); - XophpPreg.replace(normalizeWhitespaceBry, tmp_bfr_2, normalizeWhitespaceTrie, trv, Byte_ascii.Space_bry); + XophpPreg_.replace(normalizeWhitespaceBry, tmp_bfr_2, normalizeWhitespaceTrie, trv, Byte_ascii.Space_bry); return normalizeWhitespaceBry.src; } @@ -1722,7 +1722,7 @@ public class XomwSanitizer { // https://tools.ietf.org/html/rfc3454#section-3.1 // Strip them before further processing so blacklists and such work. // XO.MW.MOVED: see invalid_idn_trie - XophpPreg.replace(tmp_host.Init(url, regex_find_domain.host_bgn, regex_find_domain.host_end), tmp_bfr, invalid_idn_trie, trv, Bry_.Empty); + XophpPreg_.replace(tmp_host.Init(url, regex_find_domain.host_bgn, regex_find_domain.host_end), tmp_bfr, invalid_idn_trie, trv, Bry_.Empty); // IPv6 host names are bracketed with []. Url-decode these. // if (substr_compare("//%5B", $host, 0, 5) === 0 && diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/cache/localisation/XomwLocalisationCache.java b/400_xowa/src/gplx/xowa/mediawiki/includes/cache/localisation/XomwLocalisationCache.java index 3b3bc07fc..ee668b7e5 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/cache/localisation/XomwLocalisationCache.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/cache/localisation/XomwLocalisationCache.java @@ -590,10 +590,10 @@ public class XomwLocalisationCache { * @return array|null */ public XophpArray getPluralRules(String code) { - if (XophpObject.is_null(this.pluralRules)) { + if (XophpObject_.is_null(this.pluralRules)) { this.loadPluralFiles(); } - return (XophpArray)XophpObject.coalesce(this.pluralRules.Get_by_ary(code), null); + return (XophpArray)XophpObject_.coalesce(this.pluralRules.Get_by_ary(code), null); } // // /** diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/content/ContentHandler.java b/400_xowa/src/gplx/xowa/mediawiki/includes/content/ContentHandler.java index 3e4cb2676..b613800db 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/content/ContentHandler.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/content/ContentHandler.java @@ -532,7 +532,7 @@ public abstract class ContentHandler { return true; // this means "use the default" } - return XophpArrayUtl.in_array(format, this.mSupportedFormats); + return XophpArray_.in_array(format, this.mSupportedFormats); } /** diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/filerepo/file/XomwFile.java b/400_xowa/src/gplx/xowa/mediawiki/includes/filerepo/file/XomwFile.java index 68b88ffbb..714055446 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/filerepo/file/XomwFile.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/filerepo/file/XomwFile.java @@ -278,7 +278,7 @@ public class XomwFile { * @return String */ public byte[] getName() { - if (!XophpUtility.isset(this.name)) { + if (!XophpObject_.isset(this.name)) { // this.assertRepoDefined(); this.name = this.repo.getNameFromTitle(this.title); } @@ -292,7 +292,7 @@ public class XomwFile { * @return String */ private byte[] getExtension() { - if (!XophpUtility.isset(this.extension)) { + if (!XophpObject_.isset(this.extension)) { int n = XophpString_.strpos(this.getName(), Byte_ascii.Dot); this.extension = normalizeExtension( n != Bry_find_.Not_found ? XophpString_.substr(this.getName(), n + 1) : Bry_.Empty); @@ -329,7 +329,7 @@ public class XomwFile { * @return String */ public byte[] getUrl() { - if (!XophpUtility.isset(this.url)) { + if (!XophpObject_.isset(this.url)) { // this.assertRepoDefined(); byte[] ext = this.getExtension(); this.url = Bry_.Add(this.repo.getZoneUrl(XomwFileRepo.Zone__public, ext), Byte_ascii.Slash_bry, this.getUrlRel()); @@ -1496,7 +1496,7 @@ public class XomwFile { * @return String */ private byte[] getHashPath() { - if (!XophpUtility.isset(this.hashPath)) { + if (!XophpObject_.isset(this.hashPath)) { // this.assertRepoDefined(); this.hashPath = this.repo.getHashPath(this.getName()); } @@ -1558,7 +1558,7 @@ public class XomwFile { * @return String */ private byte[] getUrlRel() { - return Bry_.Add(this.getHashPath(), XophpEncode.rawurlencode(this.getName())); + return Bry_.Add(this.getHashPath(), XophpEncode_.rawurlencode(this.getName())); } // /** diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/interwiki/XomwInterwikiLookupAdapter.java b/400_xowa/src/gplx/xowa/mediawiki/includes/interwiki/XomwInterwikiLookupAdapter.java index 8c339c1b3..a6b35463b 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/interwiki/XomwInterwikiLookupAdapter.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/interwiki/XomwInterwikiLookupAdapter.java @@ -41,7 +41,7 @@ public class XomwInterwikiLookupAdapter implements XomwInterwikiLookup { * @return boolean Whether it exists */ public boolean isValidInterwiki(byte[] prefix) { - return XophpArrayUtl.array_key_exists(prefix, this.getInterwikiMap()); + return XophpArray_.array_key_exists(prefix, this.getInterwikiMap()); } /** @@ -71,7 +71,7 @@ public class XomwInterwikiLookupAdapter implements XomwInterwikiLookup { */ public byte[][] getAllPrefixes(boolean local) { if (!local) { - XophpArrayUtl.array_keys_bry(this.getInterwikiMap()); + XophpArray_.array_keys_bry(this.getInterwikiMap()); } List_adp res = List_adp_.New(); Ordered_hash hash = this.getInterwikiMap(); diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/libs/XomwGenericArrayObject.java b/400_xowa/src/gplx/xowa/mediawiki/includes/libs/XomwGenericArrayObject.java index 59c343371..b09c82aed 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/libs/XomwGenericArrayObject.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/libs/XomwGenericArrayObject.java @@ -85,7 +85,7 @@ public abstract class XomwGenericArrayObject extends XomwArrayObject { /** * @param mixed $value */ public void append(Object val) { - this.setElement(XophpUtility.NULL_INT, val); + this.setElement(XophpObject_.NULL_INT, val); } /** @@ -139,7 +139,7 @@ public abstract class XomwGenericArrayObject extends XomwArrayObject { /** ); } - if (XophpUtility.is_null(index)) { + if (XophpObject_.is_null(index)) { index = this.getNewOffset(); } diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/linkers/XomwLinkRenderer.java b/400_xowa/src/gplx/xowa/mediawiki/includes/linkers/XomwLinkRenderer.java index 4d4f8172f..f86ca1006 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/linkers/XomwLinkRenderer.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/linkers/XomwLinkRenderer.java @@ -305,7 +305,7 @@ public class XomwLinkRenderer { } target = this.normalizeTarget(target); - if (!XophpUtility.isset(query.action) && target.getNamespace() != XomwDefines.NS_SPECIAL) { + if (!XophpObject_.isset(query.action) && target.getNamespace() != XomwDefines.NS_SPECIAL) { query.action = Bry__action__edit; query.redlink = 1; } diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/media/XomwImageHandler.java b/400_xowa/src/gplx/xowa/mediawiki/includes/media/XomwImageHandler.java index bb4a66847..b660a8ec0 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/media/XomwImageHandler.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/media/XomwImageHandler.java @@ -28,7 +28,7 @@ public abstract class XomwImageHandler extends XomwMediaHandler { private final * @return boolean */ @Override public boolean canRender(XomwFile file) { - return (XophpUtility.istrue(file.getWidth()) && XophpUtility.istrue(file.getHeight())); + return (XophpObject_.istrue(file.getWidth()) && XophpObject_.istrue(file.getHeight())); } @Override public Xomw_param_map getParamMap() { @@ -52,10 +52,10 @@ public abstract class XomwImageHandler extends XomwMediaHandler { private final @Override public byte[] makeParamString(Xomw_params_handler handlerParams) { int width = 0; - if (XophpUtility.isset(handlerParams.physicalWidth)) { + if (XophpObject_.isset(handlerParams.physicalWidth)) { width = handlerParams.physicalWidth; } - else if (XophpUtility.isset(handlerParams.width)) { + else if (XophpObject_.isset(handlerParams.width)) { width = handlerParams.width; } else { @@ -76,7 +76,7 @@ public abstract class XomwImageHandler extends XomwMediaHandler { private final // pos = Bry_find_.Find_fwd_while_num(src, 1, len); // skip numeric // if (Bry_.Match(src, pos, len, Xomw_lnki_wkr.Bry__px)) { // matches "px" // Xomw_params_handler rv = new Xomw_params_handler(); -// rv.width = Bry_.To_int_or(src, 0, pos, XophpUtility.NULL_INT); +// rv.width = Bry_.To_int_or(src, 0, pos, XophpObject_.NULL_INT); // return rv; // } // } @@ -95,11 +95,11 @@ public abstract class XomwImageHandler extends XomwMediaHandler { private final @Override public boolean normaliseParams(XomwFile image, Xomw_params_handler handlerParams) { byte[] mimeType = image.getMimeType(); - if (!XophpUtility.isset(handlerParams.width)) { + if (!XophpObject_.isset(handlerParams.width)) { return false; } - if (!XophpUtility.isset(handlerParams.page)) { + if (!XophpObject_.isset(handlerParams.page)) { handlerParams.page = 1; } else { @@ -116,7 +116,7 @@ public abstract class XomwImageHandler extends XomwMediaHandler { private final int srcWidth = image.getWidth(handlerParams.page); int srcHeight = image.getHeight(handlerParams.page); - if (XophpUtility.isset(handlerParams.height) && handlerParams.height != -1) { + if (XophpObject_.isset(handlerParams.height) && handlerParams.height != -1) { // Height & width were both set if (handlerParams.width * srcHeight > handlerParams.height * srcWidth) { // Height is the relative smaller dimension, so scale width accordingly @@ -130,11 +130,11 @@ public abstract class XomwImageHandler extends XomwMediaHandler { private final handlerParams.physicalWidth = handlerParams.width; } else { // Height was crap, unset it so that it will be calculated later - handlerParams.height = XophpUtility.NULL_INT; + handlerParams.height = XophpObject_.NULL_INT; } } - if (!XophpUtility.isset(handlerParams.physicalWidth)) { + if (!XophpObject_.isset(handlerParams.physicalWidth)) { // Passed all validations, so set the physicalWidth handlerParams.physicalWidth = handlerParams.width; } @@ -146,7 +146,7 @@ public abstract class XomwImageHandler extends XomwMediaHandler { private final handlerParams.physicalWidth); // Set the height if it was not validated in the if block higher up - if (!XophpUtility.isset(handlerParams.height) || handlerParams.height == -1) { + if (!XophpObject_.isset(handlerParams.height) || handlerParams.height == -1) { handlerParams.height = handlerParams.physicalHeight; } diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/media/XomwImageHandler_tst.java b/400_xowa/src/gplx/xowa/mediawiki/includes/media/XomwImageHandler_tst.java index f3d2552d6..6108b6445 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/media/XomwImageHandler_tst.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/media/XomwImageHandler_tst.java @@ -36,7 +36,7 @@ class XomwImageHandler_fxt { public XomwImageHandler_fxt() { this.handler = new XomwTransformationalImageHandler(Bry_.new_a7("test_handler")); } - public Xomw_params_handler Make__handlerParams(int w) {return Make__handlerParams(w, XophpUtility.NULL_INT, XophpUtility.NULL_INT, XophpUtility.NULL_INT);} + public Xomw_params_handler Make__handlerParams(int w) {return Make__handlerParams(w, XophpObject_.NULL_INT, XophpObject_.NULL_INT, XophpObject_.NULL_INT);} public Xomw_params_handler Make__handlerParams(int w, int h, int phys_w, int phys_h) { Xomw_params_handler rv = new Xomw_params_handler(); rv.width = w; diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/media/XomwThumbnailImage.java b/400_xowa/src/gplx/xowa/mediawiki/includes/media/XomwThumbnailImage.java index 80af9b085..9493343b2 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/media/XomwThumbnailImage.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/media/XomwThumbnailImage.java @@ -135,71 +135,71 @@ public class XomwThumbnailImage extends XomwMediaTransformOutput { private final attribs.Add_many(Gfh_atr_.Bry__alt, alt); attribs.Add_many(Gfh_atr_.Bry__src, url); boolean link_attribs_is_null = false; - if (!XophpUtility.empty(options.custom_url_link)) { + if (!XophpObject_.empty(options.custom_url_link)) { link_attribs.Clear(); link_attribs.Add_many(Gfh_atr_.Bry__href, options.custom_url_link); - if (!XophpUtility.empty(options.title)) { + if (!XophpObject_.empty(options.title)) { link_attribs.Add_many(Gfh_atr_.Bry__title, options.title); } - if (XophpUtility.empty(options.custom_target_link)) { + if (XophpObject_.empty(options.custom_target_link)) { link_attribs.Add_many(Gfh_atr_.Bry__target, options.custom_target_link); } - else if (XophpUtility.empty(options.parser_extlink_target)) { + else if (XophpObject_.empty(options.parser_extlink_target)) { link_attribs.Add_many(Gfh_atr_.Bry__target, options.parser_extlink_target); } - if (XophpUtility.empty(options.parser_extlink_rel)) { + if (XophpObject_.empty(options.parser_extlink_rel)) { link_attribs.Add_many(Gfh_atr_.Bry__rel, options.parser_extlink_rel); } } - else if (!XophpUtility.empty(options.custom_title_link)) { + else if (!XophpObject_.empty(options.custom_title_link)) { // byte[] title = options.custom_title_link; // link_attribs.Clear(); // link_attribs.Add_many(Gfh_atr_.Bry__href, title.Get_link_url()); // byte[] options_title = options.title; -// link_attribs.Add_many(Gfh_atr_.Bry__title, XophpUtility.empty(options_title) ? title.Get_full_text() : options_title); +// link_attribs.Add_many(Gfh_atr_.Bry__title, XophpObject_.empty(options_title) ? title.Get_full_text() : options_title); } - else if (!XophpUtility.empty(options.desc_link)) { + else if (!XophpObject_.empty(options.desc_link)) { // link_attribs = this.getDescLinkAttribs( // empty(options['title']) ? null : options['title'], // $query // ); link_attribs.Clear(); this.getDescLinkAttribs(link_attribs, - XophpUtility.empty(options.title) ? null : options.title, + XophpObject_.empty(options.title) ? null : options.title, null); } - else if (!XophpUtility.empty(options.file_link)) { + else if (!XophpObject_.empty(options.file_link)) { // link_attribs.Clear(); // link_attribs.Add_many(Gfh_atr_.Bry__href, file.Get_url()); } else { link_attribs_is_null = true; - if (!XophpUtility.empty(options.title)) { + if (!XophpObject_.empty(options.title)) { attribs.Add_many(Gfh_atr_.Bry__title, options.title); } } - if (XophpUtility.empty(options.no_dimensions)) { + if (XophpObject_.empty(options.no_dimensions)) { attribs.Add_many(Gfh_atr_.Bry__width, Int_.To_bry(width)); attribs.Add_many(Gfh_atr_.Bry__height, Int_.To_bry(height)); } - if (!XophpUtility.empty(options.valign)) { + if (!XophpObject_.empty(options.valign)) { attribs.Add_many(Gfh_atr_.Bry__style, Bry_.Add(Bry__vertical_align, options.valign)); } - if (!XophpUtility.empty(options.img_cls)) { + if (!XophpObject_.empty(options.img_cls)) { attribs.Add_many(Gfh_atr_.Bry__class, options.img_cls); } - if (XophpUtility.isset(options.override_height)) { + if (XophpObject_.isset(options.override_height)) { attribs.Add_many(Gfh_atr_.Bry__class, options.override_height); } - if (XophpUtility.isset(options.override_width)) { + if (XophpObject_.isset(options.override_width)) { attribs.Add_many(Gfh_atr_.Bry__width, options.override_height); } // Additional densities for responsive images, if specified. // If any of these urls is the same as src url, it'll be excluded. // $responsiveUrls = array_diff(this.responsiveUrls, [ this.url ]); -// if (!XophpUtility.empty($responsiveUrls)) { +// if (!XophpObject_.empty($responsiveUrls)) { // $attribs['srcset'] = Html::srcSet($responsiveUrls); // } diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/XomwBlockLevelPass.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/XomwBlockLevelPass.java index 84283395d..1bb137b4e 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/XomwBlockLevelPass.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/XomwBlockLevelPass.java @@ -369,8 +369,8 @@ public class XomwBlockLevelPass { int tLen = t.length; // XO.MW.PORTED.BGN: - boolean openMatch = XophpPreg.match(openMatchTrie, trv, t, 0, tLen) != null; - boolean closeMatch = XophpPreg.match(closeMatchTrie, trv, t, 0, tLen) != null; + boolean openMatch = XophpPreg_.match(openMatchTrie, trv, t, 0, tLen) != null; + boolean closeMatch = XophpPreg_.match(closeMatchTrie, trv, t, 0, tLen) != null; // XO.MW.PORTED.END if (openMatch || closeMatch) { pendingPTag = PARA_STACK_NONE; @@ -382,7 +382,7 @@ public class XomwBlockLevelPass { int bqOffset = 0; // PORTED:preg_match('/<(\\/?)blockquote[\s>]/i', t, $bqMatch, PREG_OFFSET_CAPTURE, $bqOffset) while (true) { - Object o = XophpPreg.match(blockquoteTrie, trv, t, bqOffset, tLen); + Object o = XophpPreg_.match(blockquoteTrie, trv, t, bqOffset, tLen); if (o == null) { // no more blockquotes found; exit break; } diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/XomwPreprocessor_DOM.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/XomwPreprocessor_DOM.java index efb986cdb..ba67d59f5 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/XomwPreprocessor_DOM.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/XomwPreprocessor_DOM.java @@ -118,7 +118,7 @@ class XomwPreprocessor_DOM extends XomwPreprocessor { private final Bry_bfr tmp_bfr.Add_str_a7("").Add(title).Add_str_a7(""); int arg_idx = 1; - int parts_len = parts.Len(); + int parts_len = parts.count(); for (int j = 0; j < parts_len; j++) { XomwPPDPart_DOM part = (XomwPPDPart_DOM)parts.Get_at(j); if (part.eqpos != -1) { @@ -144,7 +144,7 @@ class XomwPreprocessor_DOM extends XomwPreprocessor { private final Bry_bfr } @Override protected Object preprocessToObj_term(XomwPPDStack stack) { Bry_bfr root_accum = Bry_bfr_.New().Add_str_u8(((Xomw_prepro_accum__dom)stack.Get_root_accum()).To_str()); - int stack_len = stack.stack.Len(); + int stack_len = stack.stack.count(); for (int j = 0; j < stack_len; j++) { // XomwPPDStackElement_Hash piece = (XomwPPDStackElement_Hash)stack.stack.Get_at(j); // root_accum.Add((XophpArray)piece.breakSyntax(tmp_bfr)); diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/XomwPreprocessor_Hash.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/XomwPreprocessor_Hash.java index bf2a029ab..3d466b9bf 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/XomwPreprocessor_Hash.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/XomwPreprocessor_Hash.java @@ -55,11 +55,11 @@ class XomwPreprocessor_Hash extends XomwPreprocessor { private XophpArray accum accum.Add(XophpArray.New("comment", XophpArray.New(XophpString_.substr(src, bgn, end - bgn)))); } @Override protected void preprocessToObj_removeLeadingWhitespaceFromEnd(int ws_len) { - int endIndex = accum.Len() - 1; + int endIndex = accum.count() - 1; if ( ws_len > 0 && endIndex >= 0) { Object itm_obj = accum.Get_at(endIndex); - if (XophpTypeUtl.is_string(itm_obj)) { + if (XophpType_.is_string(itm_obj)) { byte[] itm = Bry_.new_u8((String)itm_obj); if (XophpString_.strspn_fwd__space_or_tab(itm, itm.length - ws_len, -1, itm.length) == ws_len) { accum.Set(endIndex, XophpString_.substr(itm, 0, -ws_len)); @@ -86,7 +86,7 @@ class XomwPreprocessor_Hash extends XomwPreprocessor { private XophpArray accum rv.Ary().Add ( XophpArray.New ( "h", - XophpArrayUtl.array_merge + XophpArray_.array_merge ( XophpArray.New ( XophpArray.New("@level", XophpArray.New(count)) , XophpArray.New("@i" , XophpArray.New(heading_index)) @@ -98,7 +98,7 @@ class XomwPreprocessor_Hash extends XomwPreprocessor { private XophpArray accum return rv; } @Override protected void preprocessToObj_heading_end(Xomw_prepro_accum element) { - XophpArrayUtl.array_splice(accum, accum.Len(), 0, ((Xomw_prepro_accum__hash)element).Ary()); + XophpArray_.array_splice(accum, accum.count(), 0, ((Xomw_prepro_accum__hash)element).Ary()); } @Override protected Xomw_prepro_accum preprocessToObj_text(XomwPPDStackElement piece, byte[] rule_end, int matching_count) { @@ -122,14 +122,14 @@ class XomwPreprocessor_Hash extends XomwPreprocessor { private XophpArray accum children.Add(titleNode); int argIndex = 1; - int parts_len = parts.Len(); + int parts_len = parts.count(); for (int j = 0; j < parts_len; j++) { XomwPPDPart_Hash part = (XomwPPDPart_Hash)parts.Get_at(j); XophpArray part_out = (XophpArray)part.Accum_hash().Ary(); if (part.eqpos != -1) { Object equalsNode = part_out.Get_at(part.eqpos); - XophpArray nameNode = XophpArray.New("name" , XophpArrayUtl.array_slice(part_out, 0, part.eqpos)); - XophpArray valueNode = XophpArray.New("value", XophpArrayUtl.array_slice(part_out, part.eqpos + 1)); + XophpArray nameNode = XophpArray.New("name" , XophpArray_.array_slice(part_out, 0, part.eqpos)); + XophpArray valueNode = XophpArray.New("value", XophpArray_.array_slice(part_out, part.eqpos + 1)); XophpArray partNode = XophpArray.New("part" , XophpArray.New(nameNode, equalsNode, valueNode)); children.Add(partNode); } @@ -144,19 +144,19 @@ class XomwPreprocessor_Hash extends XomwPreprocessor { private XophpArray accum return new Xomw_prepro_accum__hash(element); } @Override protected void preprocessToObj_add_element(Xomw_prepro_accum element) { - XophpArrayUtl.array_splice(accum, accum.Len(), 0, ((Xomw_prepro_accum__hash)element).Ary()); + XophpArray_.array_splice(accum, accum.count(), 0, ((Xomw_prepro_accum__hash)element).Ary()); } @Override protected void preprocessToObj_equals(XomwPPDStack stack) { accum.Add(XophpArray.New("equals", XophpArray.New("="))); - stack.getCurrentPart().eqpos = accum.Len() - 1; + stack.getCurrentPart().eqpos = accum.count() - 1; } @Override protected Object preprocessToObj_term(XomwPPDStack stack) { Xomw_prepro_accum__hash stack_accum = (Xomw_prepro_accum__hash)stack.getAccum(); XophpArray stack_ary = stack_accum.Ary(); - int len = stack_ary.Len(); + int len = stack_ary.count(); for (int i = 0; i < len; i++) { // XomwPPDPart_Hash piece = (XomwPPDPart_Hash)(stack_ary.Get_at(i).Val()); -// XophpArrayUtl.array_splice(stack_ary, stack_ary.Len(), 0, piece.breakSyntax()); +// XophpArray_.array_splice(stack_ary, stack_ary.Len(), 0, piece.breakSyntax()); } // for ( $stack->stack as $piece ) { // array_splice( $stack->rootAccum, count( $stack->rootAccum ), 0, $piece->breakSyntax() ); @@ -184,9 +184,9 @@ class XomwPreprocessor_Hash extends XomwPreprocessor { private XophpArray accum private static void addLiteral(XophpArray accum, byte[] text) {addLiteral(accum, String_.new_u8(text));} private static void addLiteral(XophpArray accum, String text) { - int n = accum.Len(); + int n = accum.count(); Object itm = accum.Get_at(n - 1); - if (n > 0 && XophpTypeUtl.is_string(itm)) { + if (n > 0 && XophpType_.is_string(itm)) { accum.Set(n - 1, ((String)itm) + text); } else { diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkes/Xomw_lnke_wkr.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkes/Xomw_lnke_wkr.java index d9f508143..8064c5643 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkes/Xomw_lnke_wkr.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkes/Xomw_lnke_wkr.java @@ -164,7 +164,7 @@ public class Xomw_lnke_wkr {// THREAD.UNSAFE: caching for repeated calls // The characters '<' and '>' (which were escaped by // removeHTMLtags()) should not be included in // URLs, per RFC 2396. - if (XophpPreg.match(angle_entities_trie, trv, src, url_bgn, url_end) != null) { + if (XophpPreg_.match(angle_entities_trie, trv, src, url_bgn, url_end) != null) { int angle_bgn = trv.Match_bgn; text_bgn = angle_bgn; url_end = angle_bgn; diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_lnki_wkr.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_lnki_wkr.java index f56ee542a..037a0761d 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_lnki_wkr.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_lnki_wkr.java @@ -589,7 +589,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls break; default: // Most other things appear to be empty or numeric... - validated = (val == null || XophpUtility.isnumeric(Bry_.Trim(val))); + validated = (val == null || XophpObject_.isnumeric(Bry_.Trim(val))); break; } } @@ -724,7 +724,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls // Parsed a width param of imagelink like 300px or 200x300px // XO.MW.NOTE: for MW, "" -> null, null while "AxB" -> 0x0 public void parseWidthParam(int[] img_size, byte[] src) { - img_size[0] = img_size[1] = XophpUtility.NULL_INT; + img_size[0] = img_size[1] = XophpObject_.NULL_INT; if (src == Bry_.Empty) { return; } diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_params_frame.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_params_frame.java index 32ae0632f..769677abe 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_params_frame.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_params_frame.java @@ -44,12 +44,12 @@ public class Xomw_params_frame { } public Xomw_params_frame Clear() { desc_link = false; - upright = XophpUtility.NULL_DOUBLE; + upright = XophpObject_.NULL_DOUBLE; align = valign = caption = frame = framed = frameless = thumbnail = manualthumb = alt = title = cls = img_cls = link_title = link_url = link_target = no_link = custom_url_link = custom_target_link = desc_query - = XophpUtility.NULL_BRY; + = XophpObject_.NULL_BRY; return this; } public void Copy_to(Xomw_params_frame src) { diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_params_handler.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_params_handler.java index 900f6e5fa..764ef7d46 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_params_handler.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_params_handler.java @@ -22,7 +22,7 @@ public class Xomw_params_handler { public int physicalHeight; public Xomw_params_handler Clear() { width = height = page - = physicalWidth = physicalHeight = XophpUtility.NULL_INT; + = physicalWidth = physicalHeight = XophpObject_.NULL_INT; return this; } public void Copy_to(Xomw_params_handler src) { diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_params_scalar.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_params_scalar.java index bed194971..a040edc16 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_params_scalar.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/lnkis/Xomw_params_scalar.java @@ -28,6 +28,6 @@ public class Xomw_params_scalar { public byte[] dstUrl; public byte[] interlace; public Xomw_params_scalar() { - physicalWidth = physicalHeight = clientWidth = clientHeight = srcWidth = srcHeight = XophpUtility.NULL_INT; + physicalWidth = physicalHeight = clientWidth = clientHeight = srcWidth = srcHeight = XophpObject_.NULL_INT; } } diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPDStack.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPDStack.java index 6e58d70b7..208f10c3d 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPDStack.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPDStack.java @@ -43,7 +43,7 @@ public class XomwPPDStack { * @return int */ public int count() { - return this.stack.Count(); + return this.stack.count(); } public Xomw_prepro_accum getAccum() { @@ -65,17 +65,17 @@ public class XomwPPDStack { // $class = this.elementClass; // this.stack[] = new $class($data); // } - this.top = (XomwPPDStackElement)this.stack.Get_at(this.stack.Count() - 1); + this.top = (XomwPPDStackElement)this.stack.Get_at(this.stack.count() - 1); this.accum = this.top.getAccum(); } public XomwPPDStackElement pop() { - if (this.stack.Count() == 0) { + if (this.stack.count() == 0) { throw XomwMWException.New_by_method(XomwPPDStack.class, "pop", "no elements remaining"); } - XomwPPDStackElement temp = (XomwPPDStackElement)XophpArrayUtl.pop_obj(this.stack); - if (this.stack.Count()> 0) { - this.top = (XomwPPDStackElement)this.stack.Get_at(this.stack.Count() - 1); + XomwPPDStackElement temp = (XomwPPDStackElement)this.stack.pop(); + if (this.stack.count()> 0) { + this.top = (XomwPPDStackElement)this.stack.Get_at(this.stack.count() - 1); this.accum = this.top.getAccum(); } else { this.top = null; @@ -93,7 +93,7 @@ public class XomwPPDStack { * @return array */ public XomwPPDStackElementFlags getFlags() { - if (this.stack.Count() == 0) { + if (this.stack.count() == 0) { return XomwPPDStackElementFlags.Empty; } else { diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPDStackElement.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPDStackElement.java index 9506c7dd5..6d5da7916 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPDStackElement.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPDStackElement.java @@ -63,7 +63,7 @@ public class XomwPPDStackElement { } public Xomw_prepro_accum getAccum() { - return (Xomw_prepro_accum)Get_at(this.parts.Count() - 1).Accum(); + return (Xomw_prepro_accum)Get_at(this.parts.count() - 1).Accum(); } public void addPart(String s) { @@ -74,18 +74,18 @@ public class XomwPPDStackElement { } public XomwPPDPart getCurrentPart() { - return (XomwPPDPart)Get_at(this.parts.Count() - 1); + return (XomwPPDPart)Get_at(this.parts.count() - 1); } /** * @return array */ public XomwPPDStackElementFlags getFlags() { - int partCount = this.parts.Count(); + int partCount = this.parts.count(); boolean findPipe = String_.EqNot(this.open, "\n") && String_.EqNot(this.open, "["); return new XomwPPDStackElementFlags ( findPipe - , findPipe && partCount > 1 && !XophpUtility.isset(Get_at(partCount - 1).eqpos) + , findPipe && partCount > 1 && !XophpObject_.isset(Get_at(partCount - 1).eqpos) , String_.Eq(this.open, "\n") ); } @@ -108,7 +108,7 @@ public class XomwPPDStackElement { } bfr.Add_str(XophpString_.str_repeat(this.open, openingCount)); boolean first = true; - int parts_len = parts.Len(); + int parts_len = parts.count(); for (int i = 0; i < parts_len; i++) { XomwPPDPart_DOM part = (XomwPPDPart_DOM)Get_at(i); if (first) { diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPDStackElement_Hash.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPDStackElement_Hash.java index a0e93132c..b9bed61ca 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPDStackElement_Hash.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPDStackElement_Hash.java @@ -42,23 +42,23 @@ public class XomwPPDStackElement_Hash extends XomwPPDStackElement { public Xomw accum = XophpArray.New(XophpString_.str_repeat(this.open, openingCount)); int lastIndex = 0; boolean first = true; - int parts_len = parts.Len(); + int parts_len = parts.count(); for (int i = 0; i < parts_len; i++) { XomwPPDPart_Hash part = Get_at_hash(i); if (first) { first = false; } - else if (XophpTypeUtl.is_string(accum.Get_at_str(lastIndex))) { + else if (XophpType_.is_string(accum.Get_at_str(lastIndex))) { accum.Set(lastIndex, accum.Get_at_str(lastIndex) + "|"); } else { accum.Set(++lastIndex, "|"); } XophpArray part_out = ((Xomw_prepro_accum__hash)part.Accum()).Ary(); - int part_out_len = part_out.Len(); + int part_out_len = part_out.count(); for (int j = 0; j < part_out_len; j++) { Object node = part_out.Get_at(j); - if (XophpTypeUtl.is_string(node) && XophpTypeUtl.is_string(accum.Get_at(lastIndex))) { + if (XophpType_.is_string(node) && XophpType_.is_string(accum.Get_at(lastIndex))) { accum.Set(lastIndex, accum.Get_at_str(lastIndex) + (String)node); } else { accum.Set(++lastIndex, node); diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPFrame_Hash.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPFrame_Hash.java index 9f155c4a8..a53dbf9cc 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPFrame_Hash.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPFrame_Hash.java @@ -64,7 +64,7 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** this.preprocessor = preprocessor; this.parser = preprocessor.Parser(); this.title = this.parser.mTitle; - this.titleCache = XophpArray.New().Add(XophpObject.is_true(this.title) ? this.title.getPrefixedDBkeyStr() : XophpString_.Null); + this.titleCache = XophpArray.New().Add(XophpObject_.is_true(this.title) ? this.title.getPrefixedDBkeyStr() : XophpString_.Null); this.loopCheckHash = XophpArray.New(); this.depth = 0; this.childExpansionCache = XophpArray.New(); @@ -83,10 +83,10 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** @Override public XomwPPFrame newChild(Object argsObj, XomwTitle title, int indexOffset) { XophpArray namedArgs = XophpArray.New(); XophpArray numberedArgs = XophpArray.New(); - if (title == XophpObject.False) { + if (!XophpObject_.is_true(title)) { title = this.title; } - if (argsObj != XophpObject.False) { + if (XophpObject_.is_true(argsObj)) { XophpArray args = null; if (Type_.Eq_by_obj(argsObj, XomwPPNode_Hash_Array.class)) { args = ((XomwPPNode_Hash_Array)argsObj).value; @@ -97,7 +97,7 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** args = (XophpArray)argsObj; } - int argsLen = args.Len(); + int argsLen = args.count(); for (int i = 0; i < argsLen; i++) { XomwPPNode arg = (XomwPPNode)args.Get_at(i); XophpArray bits = arg.splitArg(); @@ -112,7 +112,7 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** // this.parser.addTrackingCategory('duplicate-args-category'); } numberedArgs.Set(index, bits.Get_by("value")); -// XophpArrayUtl.unset_by_idx(namedArgs, index); +// XophpArray_.unset_by_idx(namedArgs, index); } else { // Named parameter String name = String_.Trim(this.expand(bits.Get_by("name"), XomwPPFrame.STRIP_COMMENTS)); @@ -124,7 +124,7 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** // this.parser.addTrackingCategory('duplicate-args-category'); } // namedArgs.Set(name, bits.Get_by("value")); -// XophpArrayUtl.unset(numberedArgs, name); +// XophpArray_.unset(numberedArgs, name); } } } @@ -177,21 +177,21 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** } XophpArray outStack = XophpArray.New("", ""); - XophpArray iteratorStack = XophpArray.New(XophpObject.False, root); + XophpArray iteratorStack = XophpArray.New(XophpObject_.False, root); XophpArray indexStack = XophpArray.New(0, 0); - while (iteratorStack.Count() > 1) { - int level = outStack.Count() - 1; + while (iteratorStack.count() > 1) { + int level = outStack.count() - 1; Object iteratorNode = iteratorStack.Get_at(level); String outItm = outStack.Get_at_str(level); int index = indexStack.Get_at_int(level); Object contextNode; if (XophpArray.is_array(iteratorNode)) { XophpArray iteratorNodeArray = (XophpArray)iteratorNode; - if (index >= iteratorNodeArray.Count()) { + if (index >= iteratorNodeArray.count()) { // All done with this iterator - iteratorStack.Set(level, XophpObject.False); - contextNode = XophpObject.False; + iteratorStack.Set(level, XophpObject_.False); + contextNode = XophpObject_.False; } else { contextNode = iteratorNodeArray.Get_at(index); index++; @@ -200,8 +200,8 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** XomwPPNode_Hash_Array iteratorNodeHashArray = (XomwPPNode_Hash_Array)iteratorNode; if (index >= iteratorNodeHashArray.getLength()) { // All done with this iterator - iteratorStack.Set(level, XophpObject.False); - contextNode = XophpObject.False; + iteratorStack.Set(level, XophpObject_.False); + contextNode = XophpObject_.False; } else { contextNode = iteratorNodeHashArray.item(index); index++; @@ -210,14 +210,14 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** // Copy to contextNode and then delete from iterator stack, // because this is not an iterator but we do have to execute it once contextNode = iteratorStack.Get_at(level); - iteratorStack.Set(level, XophpObject.False); + iteratorStack.Set(level, XophpObject_.False); } - Object newIterator = XophpObject.False; + Object newIterator = XophpObject_.False; String contextName = XophpString_.Null; XophpArray contextChildren = XophpArray.False; - if (contextNode == XophpObject.False) { + if (!XophpObject_.is_true(contextNode)) { // nothing to do } else if (XophpString_.is_string(contextNode)) { outItm += (String)contextNode; @@ -234,7 +234,7 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** } else if (XophpArray.is_array(contextNode)) { XophpArray contextNodeArray = (XophpArray)contextNode; // Node descriptor array - if (contextNodeArray.Count() != 2) { + if (contextNodeArray.count() != 2) { throw XomwMWException.New_by_method(XomwPPFrame_Hash.class, "expand", ": found an array where a node descriptor should be"); } @@ -307,7 +307,7 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** // OT_WIKI will only respect in substed templates. // The other output types respect it unless NO_IGNORE is set. // extractSections() sets NO_IGNORE and so never respects it. -// if ((!XophpUtility.isset(this.parent) && this.parser.ot.Has("wiki")) // this.parent doesn't exist? +// if ((!XophpObject_.isset(this.parent) && this.parser.ot.Has("wiki")) // this.parent doesn't exist? if ((this.parser.ot.Has("wiki")) || (Bitmask_.Has_int(flags, XomwPPFrame.NO_IGNORE)) ) { @@ -358,18 +358,18 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** newIterator = contextChildren; } - if (newIterator != XophpObject.False) { + if (XophpObject_.is_true(newIterator)) { outStack.Add(""); iteratorStack.Add(newIterator); indexStack.Add(0); - } else if (iteratorStack.Get_at(level) == XophpObject.False) { + } else if (!XophpObject_.is_true(iteratorStack.Get_at(level))) { // Return accumulated value to parent // With tail recursion - while (iteratorStack.Get_at(level) == XophpObject.False && level > 0) { + while (!XophpObject_.is_true(iteratorStack.Get_at(level)) && level > 0) { outStack.Itm_str_concat_end(level - 1, outItm); - outStack.Pop(); - iteratorStack.Pop(); - indexStack.Pop(); + outStack.pop(); + iteratorStack.pop(); + indexStack.pop(); level--; } } @@ -426,7 +426,7 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** if (!XophpArray.is_array(rootObj)) { root = XophpArray.New().Add(root); } - int rootLen = root.Len(); + int rootLen = root.count(); for (int i = 0; i < rootLen; i++) { Object node = root.Get_at(i); if (first) { @@ -460,7 +460,7 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** if (!XophpArray.is_array(rootObj)) { root = XophpArray.New().Add(root); } - int rootLen = root.Len(); + int rootLen = root.count(); for (int i = 0; i < rootLen; i++) { Object node = root.Get_at(i); if (first) { @@ -495,7 +495,7 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** if (!XophpArray.is_array(rootObj)) { root = XophpArray.New((String)rootObj); } - int root_len = root.Len(); + int root_len = root.count(); for (int i = 0; i < root_len; i++) { String node = root.Get_at_str(i); if (first) { @@ -523,7 +523,7 @@ class XomwPPFrame_Hash extends XomwPPFrame { /** return this.title.getPrefixedDBkeyStr(); } else { // return isset( $this->titleCache[$level] ) ? $this->titleCache[$level] : false; - return this.titleCache.Count() > 0 ? ((String)this.titleCache.Get_at(0)) : XophpString_.Null; + return this.titleCache.count() > 0 ? ((String)this.titleCache.Get_at(0)) : XophpString_.Null; } } diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPNode_Hash_Text.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPNode_Hash_Text.java index 166cb7601..effe39a08 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPNode_Hash_Text.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPNode_Hash_Text.java @@ -32,7 +32,7 @@ public class XomwPPNode_Hash_Text extends XomwPPNode { public String value; */ public XomwPPNode_Hash_Text(XophpArray store, int index) { Object value_obj = store.Get_at(index); - if (!XophpTypeUtl.is_scalar(value_obj)) { + if (!XophpType_.is_scalar(value_obj)) { throw XomwMWException.New_by_method(XomwPPNode_Hash_Text.class, "CTOR", "given Object instead of String"); } this.value = Object_.Xto_str_strict_or_null(value_obj); diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPNode_Hash_Tree.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPNode_Hash_Tree.java index 94ab62301..d96ca4a1e 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPNode_Hash_Tree.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/preprocessors/XomwPPNode_Hash_Tree.java @@ -63,7 +63,7 @@ public class XomwPPNode_Hash_Tree extends XomwPPNode { public final String na XophpArray list = this.store.Get_at_ary(index); this.name = list.Get_at_str(0); Object rawChildrenObj = list.Get_at(1); - if (XophpTypeUtl.To_type_id(rawChildrenObj) == Type_ids_.Id__array) { + if (XophpType_.To_type_id(rawChildrenObj) == Type_ids_.Id__array) { this.rawChildren = (XophpArray)rawChildrenObj; } else { @@ -81,7 +81,7 @@ public class XomwPPNode_Hash_Tree extends XomwPPNode { public final String na */ public static XomwPPNode factory(XophpArray store, int index) { Object descriptor = store.Get_at(index); - if (!XophpUtility.isset_obj(descriptor)) { + if (!XophpObject_.isset_obj(descriptor)) { return null; } @@ -150,7 +150,7 @@ public class XomwPPNode_Hash_Tree extends XomwPPNode { public final String na * @return PPNode_Hash_Tree|PPNode_Hash_Attr|PPNode_Hash_Text|boolean */ @Override public XomwPPNode getFirstChild() { - if (XophpArrayUtl.isset(this.rawChildren, 0)) { + if (this.rawChildren.isset(0)) { return null; } else { @@ -275,7 +275,7 @@ public class XomwPPNode_Hash_Tree extends XomwPPNode { public final String na */ public static XophpArray splitRawExt(XophpArray children) { XophpArray bits = XophpArray.New(); - int len = children.Count(); + int len = children.count(); for (int i = 0; i < len; i++) { Object childObj = children.Get_at(i); if (!XophpArray.is_array(childObj)) { @@ -320,7 +320,7 @@ public class XomwPPNode_Hash_Tree extends XomwPPNode { public final String na */ public static XophpArray splitRawHeading(XophpArray children) { XophpArray bits = XophpArray.New(); - int len = children.Count(); + int len = children.count(); for (int i = 0; i < len; i++) { Object childObj = children.Get_at(i); if (!XophpArray.is_array(childObj)) { @@ -357,7 +357,7 @@ public class XomwPPNode_Hash_Tree extends XomwPPNode { public final String na public static XophpArray splitRawTemplate(XophpArray children) { XophpArray parts = XophpArray.New(); XophpArray bits = XophpArray.New().Add("lineStart" , ""); - int len = children.Count(); + int len = children.count(); for (int i = 0; i < len; i++) { Object childObj = children.Get_at(i); if (!XophpArray.is_array(childObj)) { diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/quotes/Xomw_quote_wkr.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/quotes/Xomw_quote_wkr.java index e4c98449b..f336c9853 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/quotes/Xomw_quote_wkr.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/quotes/Xomw_quote_wkr.java @@ -53,7 +53,7 @@ public class Xomw_quote_wkr {// THREAD.UNSAFE: caching for repeated calls return found ? tmp.To_bry_and_clear() : src; } private boolean Do_quotes(Bry_bfr bfr, boolean all_quotes_mode, byte[] src, int line_bgn, int line_end) { - byte[][] arr = XophpPreg.split(apos_pos_ary, src, line_bgn, line_end, Wtxt__apos, Bool_.Y); // PORTED.REGX: arr = preg_split("/(''+)/", text, -1, PREG_SPLIT_DELIM_CAPTURE); + byte[][] arr = XophpPreg_.split(apos_pos_ary, src, line_bgn, line_end, Wtxt__apos, Bool_.Y); // PORTED.REGX: arr = preg_split("/(''+)/", text, -1, PREG_SPLIT_DELIM_CAPTURE); if (arr == null) { if (all_quotes_mode) { bfr.Add_mid(src, line_bgn, line_end).Add_byte_nl(); diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/tables/Xomw_table_wkr.java b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/tables/Xomw_table_wkr.java index cb0359928..0f454e5c7 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/tables/Xomw_table_wkr.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/parsers/tables/Xomw_table_wkr.java @@ -48,13 +48,13 @@ public class Xomw_table_wkr implements gplx.core.brys.Bry_split_wkr {// THREAD.U // Closing open td, tr && table while (td_history.Len() > 0) { - if (XophpArrayUtl.popBoolOrN(td_history)) { + if (XophpArray_.popBoolOrN(td_history)) { bfr.Add_str_a7("\n"); } - if (XophpArrayUtl.popBoolOrN(tr_history)) { + if (XophpArray_.popBoolOrN(tr_history)) { bfr.Add_str_a7("\n"); } - if (!XophpArrayUtl.popBoolOrN(has_opened_tr)) { + if (!XophpArray_.popBoolOrN(has_opened_tr)) { bfr.Add_str_a7("\n"); } bfr.Add_str_a7("\n"); @@ -123,20 +123,20 @@ public class Xomw_table_wkr implements gplx.core.brys.Bry_split_wkr {// THREAD.U else if (Bry_.Eq(first_2, Wtxt__tb__end)) { // We are ending a table line = tmp.Add_str_a7("").Add_mid(line, 2, line.length).To_bry_and_clear(); - byte[] last_tag = XophpArrayUtl.popBryOrNull(last_tag_history); + byte[] last_tag = XophpArray_.popBryOrNull(last_tag_history); - if (!XophpArrayUtl.popBoolOrN(has_opened_tr)) { + if (!XophpArray_.popBoolOrN(has_opened_tr)) { line = tmp.Add_str_a7("").Add(line).To_bry_and_clear(); } - if (XophpArrayUtl.popBoolOrN(tr_history)) { + if (XophpArray_.popBoolOrN(tr_history)) { line = tmp.Add_str_a7("").Add(line).To_bry_and_clear(); } - if (XophpArrayUtl.popBoolOrN(td_history)) { + if (XophpArray_.popBoolOrN(td_history)) { line = tmp.Add_str_a7("', $indent_level ); tmp.Add(line); for (int j = 0; j < indent_level; j++) @@ -152,19 +152,19 @@ public class Xomw_table_wkr implements gplx.core.brys.Bry_split_wkr {// THREAD.U sanitizer.fixTagAttributes(tmp, Name__tr, atrs); atrs = tmp.To_bry_and_clear(); - XophpArrayUtl.popBryOrNull(tr_attributes); + XophpArray_.popBryOrNull(tr_attributes); tr_attributes.Add(atrs); line = Bry_.Empty; - byte[] last_tag = XophpArrayUtl.popBryOrNull(last_tag_history); - XophpArrayUtl.popBoolOrN(has_opened_tr); + byte[] last_tag = XophpArray_.popBryOrNull(last_tag_history); + XophpArray_.popBoolOrN(has_opened_tr); has_opened_tr.Add(true); - if (XophpArrayUtl.popBoolOrN(tr_history)) { + if (XophpArray_.popBoolOrN(tr_history)) { line = Html__tr__end; } - if (XophpArrayUtl.popBoolOrN(td_history)) { + if (XophpArray_.popBoolOrN(td_history)) { line = tmp.Add_str_a7("\n").To_bry_and_clear(); } tr_history.Add(true); tr_attributes.Add(Bry_.Empty); - XophpArrayUtl.popBoolOrN(has_opened_tr); + XophpArray_.popBoolOrN(has_opened_tr); has_opened_tr.Add(true); } - byte[] last_tag = XophpArrayUtl.popBryOrNull(last_tag_history); + byte[] last_tag = XophpArray_.popBryOrNull(last_tag_history); - if (XophpArrayUtl.popBoolOrN(td_history)) { + if (XophpArray_.popBoolOrN(td_history)) { previous = tmp.Add_str_a7("\n").Add(previous).To_bry_and_clear(); } diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/site/XomwMediaWikiSite.java b/400_xowa/src/gplx/xowa/mediawiki/includes/site/XomwMediaWikiSite.java index c6d7d0416..717371419 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/site/XomwMediaWikiSite.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/site/XomwMediaWikiSite.java @@ -111,7 +111,7 @@ public class XomwMediaWikiSite extends XomwSite { private static final String PA * @return String */ public String getRelativePagePath() { - return XophpUrl.parse_url(this.getPath(XomwMediaWikiSite.PATH_PAGE), XophpUrl.PHP_URL_PATH); + return XophpUrl_.parse_url(this.getPath(XomwMediaWikiSite.PATH_PAGE), XophpUrl_.PHP_URL_PATH); } /** @@ -122,7 +122,7 @@ public class XomwMediaWikiSite extends XomwSite { private static final String PA * @return String */ public String getRelativeFilePath() { - return XophpUrl.parse_url(this.getPath(XomwMediaWikiSite.PATH_FILE), XophpUrl.PHP_URL_PATH); + return XophpUrl_.parse_url(this.getPath(XomwMediaWikiSite.PATH_FILE), XophpUrl_.PHP_URL_PATH); } /** diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/site/XomwSite.java b/400_xowa/src/gplx/xowa/mediawiki/includes/site/XomwSite.java index a4ef595a2..be961dbb0 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/site/XomwSite.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/site/XomwSite.java @@ -264,7 +264,7 @@ public class XomwSite { return null; } - return XophpUrl.parse_url(path, XophpUrl.PHP_URL_HOST); + return XophpUrl_.parse_url(path, XophpUrl_.PHP_URL_HOST); } @@ -283,7 +283,7 @@ public class XomwSite { return ""; } - String protocol = XophpUrl.parse_url(path, XophpUrl.PHP_URL_SCHEME); + String protocol = XophpUrl_.parse_url(path, XophpUrl_.PHP_URL_SCHEME); // Malformed URL if (protocol == null) { @@ -371,7 +371,7 @@ public class XomwSite { } if (pageName != null) { - url = String_.new_u8(XophpString_.str_replace(Bry_.new_a7("$1"), XophpEncode.rawurlencode(Bry_.new_u8(pageName)), Bry_.new_u8(url))); + url = String_.new_u8(XophpString_.str_replace(Bry_.new_a7("$1"), XophpEncode_.rawurlencode(Bry_.new_u8(pageName)), Bry_.new_u8(url))); } return url; diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/site/XomwSiteList.java b/400_xowa/src/gplx/xowa/mediawiki/includes/site/XomwSiteList.java index 8f725b81a..71627c98d 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/site/XomwSiteList.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/site/XomwSiteList.java @@ -103,14 +103,14 @@ public class XomwSiteList extends XomwGenericArrayObject { public int Len() {ret */ XomwSite site = (XomwSite)this.offsetGet(index); - XophpArrayUtl.unset(this.byGlobalId, site.getGlobalId()); - XophpArrayUtl.unset(this.byInternalId, site.getInternalId()); + XophpArray_.unset(this.byGlobalId, site.getGlobalId()); + XophpArray_.unset(this.byInternalId, site.getInternalId()); Ordered_hash ids = site.getNavigationIds(); int len = ids.Len(); for (int i = 0; i < len; i++) { int navId = Int_.Cast(ids.Get_at(i)); - XophpArrayUtl.unset(this.byNavigationId, navId); + XophpArray_.unset(this.byNavigationId, navId); } } @@ -126,7 +126,7 @@ public class XomwSiteList extends XomwGenericArrayObject { public int Len() {ret * @return array */ public String[] getGlobalIdentifiers() { - return XophpArrayUtl.array_keys_str(this.byGlobalId); + return XophpArray_.array_keys_str(this.byGlobalId); } /** @@ -137,7 +137,7 @@ public class XomwSiteList extends XomwGenericArrayObject { public int Len() {ret * @return boolean */ public boolean hasSite(String globalSiteId) { - return XophpArrayUtl.array_key_exists(globalSiteId, this.byGlobalId); + return XophpArray_.array_key_exists(globalSiteId, this.byGlobalId); } /** @@ -174,7 +174,7 @@ public class XomwSiteList extends XomwGenericArrayObject { public int Len() {ret * @return boolean */ @Override public boolean isEmpty() { - return XophpArrayUtl.array_is_empty(this.byGlobalId); + return XophpArray_.array_is_empty(this.byGlobalId); } /** @@ -185,7 +185,7 @@ public class XomwSiteList extends XomwGenericArrayObject { public int Len() {ret * @return boolean */ public boolean hasInternalId(int id) { - return XophpArrayUtl.array_key_exists(id, this.byInternalId); + return XophpArray_.array_key_exists(id, this.byInternalId); } /** @@ -222,7 +222,7 @@ public class XomwSiteList extends XomwGenericArrayObject { public int Len() {ret * @return boolean */ public boolean hasNavigationId(String id) { - return XophpArrayUtl.array_key_exists(id, this.byNavigationId); + return XophpArray_.array_key_exists(id, this.byNavigationId); } /** diff --git a/400_xowa/src/gplx/xowa/mediawiki/includes/title/XomwMediaWikiTitleCodec.java b/400_xowa/src/gplx/xowa/mediawiki/includes/title/XomwMediaWikiTitleCodec.java index 9f96c8f36..df05860d1 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/includes/title/XomwMediaWikiTitleCodec.java +++ b/400_xowa/src/gplx/xowa/mediawiki/includes/title/XomwMediaWikiTitleCodec.java @@ -285,13 +285,13 @@ public class XomwMediaWikiTitleCodec implements XomwTitleFormatter { if (XomwRegexTitlePrefix.preg_match(m, dbkey)) { byte[] p = m[0]; int ns = this.language.getNsIndex(p); - if (ns != XophpUtility.NULL_INT) { + if (ns != XophpObject_.NULL_INT) { // Ordinary namespace dbkey = m[1]; parts.ns = ns; // For Talk:X pages, check if X has a "namespace" prefix if (ns == XomwDefines.NS_TALK && XomwRegexTitlePrefix.preg_match(m, dbkey)) { - if (this.language.getNsIndex(m[0]) != XophpUtility.NULL_INT) { + if (this.language.getNsIndex(m[0]) != XophpObject_.NULL_INT) { // Disallow Talk:File:x type titles... throw new XomwMalformedTitleException("title-invalid-talk-namespace", text); } diff --git a/400_xowa/src/gplx/xowa/mediawiki/languages/XomwLanguage.java b/400_xowa/src/gplx/xowa/mediawiki/languages/XomwLanguage.java index c212017a6..32874b1d2 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/languages/XomwLanguage.java +++ b/400_xowa/src/gplx/xowa/mediawiki/languages/XomwLanguage.java @@ -392,7 +392,7 @@ public class XomwLanguage { public static boolean isValidBuiltInCode(String code) { if (!XophpString_.is_string(code)) { -// if (XophpObject.is_object(code)) { +// if (XophpObject_.is_object(code)) { // addmsg = " of class " . get_class(code); // } else { // addmsg = ""; @@ -4038,12 +4038,12 @@ public class XomwLanguage { return (String)formsObject; } forms = (XophpArray)formsObject; - if (!forms.Count_bool()) { + if (!forms.count_bool()) { return ""; } int pluralForm = this.getPluralRuleIndexNumber(count); - pluralForm = XophpMath.min(pluralForm, forms.Count() - 1); + pluralForm = XophpMath_.min(pluralForm, forms.count() - 1); return forms.Get_at_str(pluralForm); } @@ -4064,7 +4064,7 @@ public class XomwLanguage { */ public Object handleExplicitPluralForms(String count, XophpArray forms) { XophpArray mutable = forms.Clone(); - int len = forms.Len(); + int len = forms.count(); for (int i = 0; i < len; i++) { XophpArrayItm formItem = forms.Get_at_itm(i); String index = formItem.Key(); @@ -4074,11 +4074,11 @@ public class XomwLanguage { if (String_.Eq(XophpString_.substr(form, 0, pos), count)) { return XophpString_.substr(form, pos + 1); } - mutable.Unset(index); + mutable.unset(index); } } - return XophpArrayUtl.array_values(mutable); + return mutable.values(); } private static final Regx_adp handleExplicitPluralForms_digits = Regx_adp_.new_("\\d+="); @@ -4562,7 +4562,7 @@ public class XomwLanguage { */ public static String getFallbackFor(String code) { XophpArray fallbacks = XomwLanguage.getFallbacksFor(code); - if (XophpObject.is_true(fallbacks)) { + if (XophpObject_.is_true(fallbacks)) { return fallbacks.Get_at_str(0); } return null; @@ -4986,12 +4986,12 @@ public class XomwLanguage { XophpArray pluralRules = (XophpArray)XomwLanguage.dataCacheXowa.getItem_ary(XophpString_.strtolower(this.mCode), "compiledPluralRules"); if (pluralRules == null) return getCompiledPluralRulesEmpty; XophpArray fallbacks = XomwLanguage.getFallbacksFor(this.mCode); - if (!XophpObject.is_true(pluralRules)) { - int fallbacks_len = fallbacks.Len(); + if (!XophpObject_.is_true(pluralRules)) { + int fallbacks_len = fallbacks.count(); for (int i = 0; i < fallbacks_len; i++) { String fallbackCode = fallbacks.Get_at_str(i); pluralRules = XomwLanguage.dataCacheXowa.getItem_ary(XophpString_.strtolower(fallbackCode), "compiledPluralRules"); - if (XophpObject.is_true(pluralRules)) { + if (XophpObject_.is_true(pluralRules)) { break; } } diff --git a/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/Converter/XomwOperator.java b/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/Converter/XomwOperator.java index 0f193550a..782267a62 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/Converter/XomwOperator.java +++ b/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/Converter/XomwOperator.java @@ -97,8 +97,8 @@ public class XomwOperator extends XomwFragment { /** @var String The name */ String rightType = XomwOperator.typeSpecMap.Get_by_str(String_.CharAt(typeSpec, 1)); String resultType = XomwOperator.typeSpecMap.Get_by_str(String_.CharAt(typeSpec, 2)); - int start = XophpMath.min_many(this.pos, left.pos, right.pos); - int end = XophpMath.max_many(this.end, left.end, right.end); + int start = XophpMath_.min_many(this.pos, left.pos, right.pos); + int end = XophpMath_.max_many(this.end, left.end, right.end); int length = end - start; XomwExpression newExpr = new XomwExpression(this.parser, resultType, diff --git a/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/XomwConverter.java b/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/XomwConverter.java index 36c439ad1..e29224531 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/XomwConverter.java +++ b/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/XomwConverter.java @@ -166,9 +166,9 @@ public class XomwConverter { // Make sure the result is sane. The first case is possible for an empty // String input, the second should be unreachable. - if (!this.operands.Count_bool()) { + if (!this.operands.count_bool()) { this.error("condition expected"); - } else if (this.operands.Count() > 1) { + } else if (this.operands.count() > 1) { this.error("missing operator or too many operands"); } @@ -293,7 +293,7 @@ public class XomwConverter { * @param Operator op */ protected void doOperation(XomwOperator op, Object ignore) { // NOTE: MW passes 2 args, but method only has 1 - if (this.operands.Count() < 2) { + if (this.operands.count() < 2) { op.error("missing operand"); } XomwExpression right = (XomwExpression)this.operands.pop(); diff --git a/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/XomwEvaluator.java b/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/XomwEvaluator.java index 1da862a2e..b7be17812 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/XomwEvaluator.java +++ b/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/XomwEvaluator.java @@ -42,7 +42,7 @@ public class XomwEvaluator { XophpArray rv = XophpArray.New(); // We can't use array_map() for this because it generates a warning if // there is an exception. - int rules_len = rules.Len(); + int rules_len = rules.count(); for (int i = 0; i < rules_len; i++) { String rule = rules.Get_at_str(i); rule = XomwConverter.convert(rule); @@ -69,7 +69,7 @@ public class XomwEvaluator { XophpArray m = XophpArray.New(); if (!XophpRegex_.preg_match_bool(gplx.langs.regxs.Regx_adp_.new_("^-?(([0-9]+)(?:\\.([0-9]+))?)"), number_str, m, 0, 0)) { XomwLog_.wfDebug_by_method("evaluateCompiled", ": invalid number input, returning \"other\"\n"); - return rules.Count(); + return rules.count(); } XophpArray operandSymbols = null; @@ -98,7 +98,7 @@ public class XomwEvaluator { // The compiled form is RPN, with tokens strictly delimited by // spaces, so this is a simple RPN evaluator. - int rules_len = rules.Len(); + int rules_len = rules.count(); for (int i = 0; i < rules_len; i++) { String rule = rules.Get_at_str(i); XophpArray stack = XophpArray.New(); @@ -125,7 +125,7 @@ public class XomwEvaluator { } // None of the provided rules match. The number belongs to category // "other", which comes last. - return rules.Count(); + return rules.count(); } /** @@ -171,10 +171,10 @@ public class XomwEvaluator { } else if (String_.Eq(token, "mod")) { if (left.Tid() == XomwStackItem.Tid__number) { - return XomwStackItem.New__number(XophpMath.fmod_decimal(left.As_num(), right.As_num())); + return XomwStackItem.New__number(XophpMath_.fmod_decimal(left.As_num(), right.As_num())); } - return XomwStackItem.New__number(XophpMath.fmod_decimal(left.As_num(), right.As_num())); + return XomwStackItem.New__number(XophpMath_.fmod_decimal(left.As_num(), right.As_num())); } else if (String_.Eq(token, ",")) { XomwRange range = null; diff --git a/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/XomwRange.java b/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/XomwRange.java index 94652c519..05c10e3cb 100644 --- a/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/XomwRange.java +++ b/400_xowa/src/gplx/xowa/mediawiki/vendor/wikimedia/cldr_plural_rule_parser/src/XomwRange.java @@ -50,7 +50,7 @@ class XomwRange { */ public boolean isNumberIn(Decimal_adp number) {return isNumberIn(number, true);} public boolean isNumberIn(Decimal_adp number, boolean integerConstraint) { - int parts_len = parts.Len(); + int parts_len = parts.count(); for (int i = 0; i < parts_len; i++) { Object part_obj = this.parts.Get_at(i); if (XophpArray.is_array(part_obj)) { @@ -91,7 +91,7 @@ class XomwRange { */ public void add(Object otherObj) { if (Type_.Eq_by_obj(otherObj, XomwRange.class)) { - this.parts = XophpArrayUtl.array_merge(this.parts, ((XomwRange)otherObj).parts); + this.parts = XophpArray_.array_merge(this.parts, ((XomwRange)otherObj).parts); } else { this.parts.Add(otherObj); } @@ -105,7 +105,7 @@ class XomwRange { */ @Override public String toString() { String s = "Range("; - int parts_len = this.parts.Len(); + int parts_len = this.parts.count(); for (int i = 0; i < parts_len; i++) { Object part_obj = this.parts.Get_at(i); if (i > 0) { diff --git a/400_xowa/src/gplx/xowa/xtns/pfuncs/langs/Pfunc_plural.java b/400_xowa/src/gplx/xowa/xtns/pfuncs/langs/Pfunc_plural.java index dc7a4c948..4f8b9d263 100644 --- a/400_xowa/src/gplx/xowa/xtns/pfuncs/langs/Pfunc_plural.java +++ b/400_xowa/src/gplx/xowa/xtns/pfuncs/langs/Pfunc_plural.java @@ -39,8 +39,8 @@ public class Pfunc_plural extends Pf_func_base { // no match for explicit key; take results (which has removed all explicit keys) and get plural rule index; EX: {{plural:1|2=two|3=three|one|many}} -> {{plural:?|one|many}} XophpArray resultArray = (XophpArray)result; int idx = ctx.Lang().Mw_lang().getPluralRuleIndexNumber(number_str); - if (idx >= resultArray.Count()) // bound-check; EX: {{plural:2|wiki}} -> idx = 1 -> idx = 0 - idx = resultArray.Count() - 1; + if (idx >= resultArray.count()) // bound-check; EX: {{plural:2|wiki}} -> idx = 1 -> idx = 0 + idx = resultArray.count() - 1; bfr.Add_str_u8(resultArray.Get_at_str(idx)); } } diff --git a/400_xowa/src/gplx/xowa/xtns/proofreadPage/Pp_pages_nde.java b/400_xowa/src/gplx/xowa/xtns/proofreadPage/Pp_pages_nde.java index fdd6b4b61..c5a69079f 100644 --- a/400_xowa/src/gplx/xowa/xtns/proofreadPage/Pp_pages_nde.java +++ b/400_xowa/src/gplx/xowa/xtns/proofreadPage/Pp_pages_nde.java @@ -124,7 +124,7 @@ public class Pp_pages_nde implements Xox_xnde, Mwh_atr_itm_owner1 { else { header = Toc_bry; } - if (header != null && XophpBool.is_true(header)) {// check if header is true; ignore values like header=0; ISSUE#:622; DATE:2019-11-28 + if (header != null && XophpBool_.is_true(header)) {// check if header is true; ignore values like header=0; ISSUE#:622; DATE:2019-11-28 rv = Bld_wikitext_for_header(full_bfr, index_page, rv); } return rv; diff --git a/400_xowa/src/gplx/xowa/xtns/scribunto/libs/Scrib_lib_language.java b/400_xowa/src/gplx/xowa/xtns/scribunto/libs/Scrib_lib_language.java index e5e110e8a..3e24a12a6 100644 --- a/400_xowa/src/gplx/xowa/xtns/scribunto/libs/Scrib_lib_language.java +++ b/400_xowa/src/gplx/xowa/xtns/scribunto/libs/Scrib_lib_language.java @@ -196,7 +196,7 @@ public class Scrib_lib_language implements Scrib_lib { if (num != null) { // MW: if num present, check options table for noCommafy arg; Keyval[] kv_ary = args.Cast_kv_ary_or_null(2); if (kv_ary != null) { - skip_commafy = !XophpUtility.empty_obj(Keyval_.Ary_get_by_key_or_null(kv_ary, "noCommafy")); + skip_commafy = !XophpObject_.empty_obj(Keyval_.Ary_get_by_key_or_null(kv_ary, "noCommafy")); } } byte[] rv = lang.Num_mgr().Format_num(num, skip_commafy);