mirror of
https://github.com/gnosygnu/xowa.git
synced 2025-05-31 22:44:34 +00:00
Refactor: Refactor Dbmeta classes; Rename methods of list and hash classes
This commit is contained in:
parent
231e10bc19
commit
197e0aa863
@ -86,7 +86,7 @@ public class Bry_split_ {
|
||||
cur_pos = find_pos + dlm_len;
|
||||
if (cur_pos >= src_end) break;
|
||||
}
|
||||
return (byte[][])rv.To_ary(byte[].class);
|
||||
return (byte[][])rv.ToAry(byte[].class);
|
||||
}
|
||||
public static byte[][] Split_lines(byte[] src) {
|
||||
if (Bry_.Len_eq_0(src)) return Bry_.Ary_empty;
|
||||
@ -112,7 +112,7 @@ public class Bry_split_ {
|
||||
if (last) break;
|
||||
src_pos = nxt_bgn;
|
||||
}
|
||||
return (byte[][])rv.To_ary(byte[].class);
|
||||
return (byte[][])rv.ToAry(byte[].class);
|
||||
}
|
||||
public static byte[][] Split_w_max(byte[] src, byte dlm, int max) {
|
||||
byte[][] rv = new byte[max][];
|
||||
@ -149,7 +149,7 @@ public class Bry_split_ {
|
||||
pos = end + 1;
|
||||
if (pos >= len) break;
|
||||
}
|
||||
return (byte[][])list.To_ary_and_clear(byte[].class);
|
||||
return (byte[][])list.ToAryAndClear(byte[].class);
|
||||
}
|
||||
|
||||
|
||||
@ -166,7 +166,7 @@ class Bry_split_wkr__to_ary implements gplx.core.brys.Bry_split_wkr {
|
||||
}
|
||||
public byte[][] To_ary() {
|
||||
synchronized (list) {
|
||||
return (byte[][])list.To_ary_and_clear(byte[].class);
|
||||
return (byte[][])list.ToAryAndClear(byte[].class);
|
||||
}
|
||||
}
|
||||
public static final Bry_split_wkr__to_ary Instance = new Bry_split_wkr__to_ary(); Bry_split_wkr__to_ary() {}
|
||||
|
@ -84,6 +84,6 @@ class Bry_split_wkr__example implements gplx.core.brys.Bry_split_wkr {
|
||||
return Bry_split_.Rv__ok;
|
||||
}
|
||||
public byte[][] To_ary() {
|
||||
return (byte[][])list.To_ary_and_clear(byte[].class);
|
||||
return (byte[][])list.ToAryAndClear(byte[].class);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,8 @@ 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;
|
||||
import gplx.core.primitives.*; import gplx.core.strings.*; import gplx.core.brys.*; import gplx.core.interfaces.*;
|
||||
import gplx.core.primitives.*; import gplx.core.strings.*;
|
||||
import gplx.core.interfaces.*;
|
||||
public class GfoMsg_ {
|
||||
public static GfoMsg as_(Object obj) {return obj instanceof GfoMsg ? (GfoMsg)obj : null;}
|
||||
public static final GfoMsg Null = new GfoMsg_base().ctor_("<<NULL MSG>>", false);
|
||||
@ -55,7 +56,7 @@ public class GfoMsg_ {
|
||||
|
||||
GfoMsg root = GfoMsg_.new_parse_((String)list.Get_at(0));
|
||||
GfoMsg cur = root;
|
||||
for (int i = 1; i < list.Count(); i++) {
|
||||
for (int i = 1; i < list.Len(); i++) {
|
||||
String k = (String)list.Get_at(i);
|
||||
GfoMsg mm = GfoMsg_.new_parse_(k);
|
||||
cur.Subs_add(mm);
|
||||
@ -78,7 +79,7 @@ public class GfoMsg_ {
|
||||
if (ary_len == 0) return Hash_adp_.Noop;
|
||||
Hash_adp rv = Hash_adp_.New();
|
||||
for (int i = 0; i < ary_len; i++) {
|
||||
rv.Add_if_dupe_use_1st(ary[i], ary[i]);
|
||||
rv.AddIfDupeUse1st(ary[i], ary[i]);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@ -99,11 +100,11 @@ class GfoMsg_rdr extends GfoMsg_base {
|
||||
}
|
||||
class GfoMsg_base implements GfoMsg {
|
||||
public String Key() {return key;} private String key;
|
||||
public int Subs_count() {return subs == null ? 0 : subs.Count();}
|
||||
public int Subs_count() {return subs == null ? 0 : subs.Len();}
|
||||
public GfoMsg Subs_getAt(int i) {return subs == null ? null : (GfoMsg)subs.Get_at(i);}
|
||||
public GfoMsg Subs_add(GfoMsg m) {if (subs == null) subs = List_adp_.New(); subs.Add(m); return this;}
|
||||
public GfoMsg Subs_(GfoMsg... ary) {for (GfoMsg m : ary) Subs_add(m); return this;}
|
||||
public int Args_count() {return args == null ? 0 : args.Count();}
|
||||
public int Args_count() {return args == null ? 0 : args.Len();}
|
||||
public void Args_reset() {
|
||||
counter = 0;
|
||||
Args_reset(this);
|
||||
@ -124,7 +125,7 @@ class GfoMsg_base implements GfoMsg {
|
||||
public Keyval Args_getAt(int i) {return args == null ? null : (Keyval)args.Get_at(i);}
|
||||
public GfoMsg Args_ovr(String k, Object v) {
|
||||
if (args == null) args = List_adp_.New();
|
||||
for (int i = 0; i < args.Count(); i++) {
|
||||
for (int i = 0; i < args.Len(); i++) {
|
||||
Keyval kv = (Keyval)args.Get_at(i);
|
||||
if (String_.Eq(k, kv.Key())) {
|
||||
kv.Val_(v);
|
||||
@ -184,13 +185,13 @@ class GfoMsg_base implements GfoMsg {
|
||||
protected Object ReadOr(String k, Object defaultOr) {
|
||||
if (args == null) return Nil; // WORKAROUND.gfui: args null for DataBndr_whenEvt_execCmd
|
||||
if (!String_.Eq(k, "")) {
|
||||
for (int i = 0; i < args.Count(); i++) {
|
||||
for (int i = 0; i < args.Len(); i++) {
|
||||
Keyval kv = (Keyval)args.Get_at(i);
|
||||
if (String_.Eq(k, kv.Key())) return kv.Val();
|
||||
}
|
||||
}
|
||||
if (counter >= args.Count()) return Nil;
|
||||
for (int i = 0; i < args.Count(); i++) {
|
||||
if (counter >= args.Len()) return Nil;
|
||||
for (int i = 0; i < args.Len(); i++) {
|
||||
Keyval kv = (Keyval)args.Get_at(i);
|
||||
if (String_.Eq(kv.Key(), "") && i >= counter) {
|
||||
counter++;
|
||||
@ -213,12 +214,12 @@ class GfoMsg_base implements GfoMsg {
|
||||
GfoMsg_base rv = new GfoMsg_base().ctor_(key, parse);
|
||||
if (args != null) {
|
||||
rv.args = List_adp_.New();
|
||||
for (int i = 0; i < args.Count(); i++)
|
||||
for (int i = 0; i < args.Len(); i++)
|
||||
rv.args.Add(args.Get_at(i));
|
||||
}
|
||||
if (subs != null) {
|
||||
rv.subs = List_adp_.New();
|
||||
for (int i = 0; i < args.Count(); i++) {
|
||||
for (int i = 0; i < args.Len(); i++) {
|
||||
GfoMsg sub = (GfoMsg)args.Get_at(i);
|
||||
rv.subs.Add(sub.CloneNew()); // NOTE: recursion
|
||||
}
|
||||
|
@ -17,12 +17,12 @@ package gplx;
|
||||
public class GfoTemplateFactory implements Gfo_invk {
|
||||
public void Reg(String key, GfoTemplate template) {hash.Add(key, template);}
|
||||
public Object Make(String key) {
|
||||
GfoTemplate template = (GfoTemplate)hash.Get_by(key);
|
||||
GfoTemplate template = (GfoTemplate)hash.GetByOrNull(key);
|
||||
return template.NewCopy(template);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
ctx.Match(k, k);
|
||||
Object o = hash.Get_by(k);
|
||||
Object o = hash.GetByOrNull(k);
|
||||
return o == null ? Gfo_invk_.Rv_unhandled : o;
|
||||
}
|
||||
public static final GfoTemplateFactory Instance = new GfoTemplateFactory(); GfoTemplateFactory() {}
|
||||
|
@ -14,7 +14,6 @@ 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;
|
||||
import gplx.core.lists.*;
|
||||
public class Gfo_evt_mgr {
|
||||
private final Gfo_evt_mgr_owner sender; private Ordered_hash subsRegy, pubsRegy;
|
||||
public Gfo_evt_mgr(Gfo_evt_mgr_owner sender) {this.sender = sender;}
|
||||
@ -29,7 +28,7 @@ public class Gfo_evt_mgr {
|
||||
pub.Evt_mgr().lnks.Add(this);
|
||||
} List_adp lnks;
|
||||
void AddInList(Ordered_hash regy, String key, GfoEvLnk lnk) {
|
||||
GfoEvLnkList list = (GfoEvLnkList)regy.Get_by(key);
|
||||
GfoEvLnkList list = (GfoEvLnkList)regy.GetByOrNull(key);
|
||||
if (list == null) {
|
||||
list = new GfoEvLnkList(key);
|
||||
regy.Add(key, list);
|
||||
@ -42,7 +41,7 @@ public class Gfo_evt_mgr {
|
||||
}
|
||||
@gplx.Internal protected void Pub(GfsCtx ctx, String evt, GfoMsg m) {
|
||||
ctx.MsgSrc_(sender);
|
||||
GfoEvLnkList subs = subsRegy == null ? null : (GfoEvLnkList)subsRegy.Get_by(evt);
|
||||
GfoEvLnkList subs = subsRegy == null ? null : (GfoEvLnkList)subsRegy.GetByOrNull(evt);
|
||||
if (subs != null) {
|
||||
for (int i = 0; i < subs.Count(); i++) {
|
||||
GfoEvLnk lnk = (GfoEvLnk)subs.Get_at(i);
|
||||
@ -50,7 +49,7 @@ public class Gfo_evt_mgr {
|
||||
}
|
||||
}
|
||||
if (lnks != null) {
|
||||
for (int i = 0; i < lnks.Count(); i++) {
|
||||
for (int i = 0; i < lnks.Len(); i++) {
|
||||
Gfo_evt_mgr lnk = (Gfo_evt_mgr)lnks.Get_at(i);
|
||||
lnk.Pub(ctx, evt, m);
|
||||
}
|
||||
@ -67,14 +66,14 @@ public class Gfo_evt_mgr {
|
||||
@gplx.Internal protected void RlsRegyObj(Ordered_hash regy, Gfo_evt_mgr_owner eobj, boolean pub) {
|
||||
if (regy == null) return;
|
||||
List_adp delList = List_adp_.New();
|
||||
for (int i = 0; i < regy.Count(); i++) {
|
||||
for (int i = 0; i < regy.Len(); i++) {
|
||||
GfoEvLnkList pubsList = (GfoEvLnkList)regy.Get_at(i);
|
||||
delList.Clear();
|
||||
for (int j = 0; j < pubsList.Count(); j++) {
|
||||
GfoEvLnk lnk = (GfoEvLnk)pubsList.Get_at(j);
|
||||
if (lnk.End(!pub) == eobj) delList.Add(lnk);
|
||||
}
|
||||
for (int j = 0; j < delList.Count(); j++) {
|
||||
for (int j = 0; j < delList.Len(); j++) {
|
||||
GfoEvLnk del = (GfoEvLnk)delList.Get_at(j);
|
||||
del.End(pub).Evt_mgr().RlsLnk(!pub, pubsList.Key(), del.End(!pub));
|
||||
pubsList.Del(del);
|
||||
@ -83,13 +82,13 @@ public class Gfo_evt_mgr {
|
||||
}
|
||||
@gplx.Internal protected void RlsLnk(boolean pubEnd, String key, Gfo_evt_mgr_owner endObj) {
|
||||
Ordered_hash regy = pubEnd ? pubsRegy : subsRegy;
|
||||
GfoEvLnkList list = (GfoEvLnkList)regy.Get_by(key);
|
||||
GfoEvLnkList list = (GfoEvLnkList)regy.GetByOrNull(key);
|
||||
List_adp delList = List_adp_.New();
|
||||
for (int i = 0; i < list.Count(); i++) {
|
||||
GfoEvLnk lnk = (GfoEvLnk)list.Get_at(i);
|
||||
if (lnk.End(pubEnd) == endObj) delList.Add(lnk);
|
||||
}
|
||||
for (int i = 0; i < delList.Count(); i++) {
|
||||
for (int i = 0; i < delList.Len(); i++) {
|
||||
GfoEvLnk lnk = (GfoEvLnk)delList.Get_at(i);
|
||||
list.Del(lnk);
|
||||
}
|
||||
@ -98,7 +97,7 @@ public class Gfo_evt_mgr {
|
||||
}
|
||||
class GfoEvLnkList {
|
||||
public String Key() {return key;} private String key;
|
||||
public int Count() {return list.Count();}
|
||||
public int Count() {return list.Len();}
|
||||
public void Add(GfoEvLnk lnk) {list.Add(lnk);}
|
||||
public void Del(GfoEvLnk lnk) {list.Del(lnk);}
|
||||
public GfoEvLnk Get_at(int i) {return (GfoEvLnk)list.Get_at(i);}
|
||||
|
@ -60,7 +60,7 @@ class MockEvObj implements Gfo_evt_itm {
|
||||
}
|
||||
List_adp handled = List_adp_.New();
|
||||
public void tst_Handled(String... expd) {
|
||||
Tfds.Eq_ary_str(expd, handled.To_str_ary());
|
||||
Tfds.Eq_ary_str(expd, handled.ToStrAry());
|
||||
handled.Clear();
|
||||
}
|
||||
public MockEvObj(){eventMgr = new Gfo_evt_mgr(this);}
|
||||
|
@ -34,7 +34,7 @@ public class Gfo_invk_cmd_mgr {
|
||||
return this;
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m, Object host) {
|
||||
for (int i = 0; i < list.Count(); i++) {
|
||||
for (int i = 0; i < list.Len(); i++) {
|
||||
GfoInvkCmdItm itm = (GfoInvkCmdItm)list.Get_at(i);
|
||||
if (itm.Type_isXtn()) {
|
||||
Object invkVal = itm.Invk().Invk(ctx, ikey, k, m);
|
||||
|
@ -27,7 +27,7 @@ public class Gfo_usr_dlg_ {
|
||||
}
|
||||
public static String Test__list__term__get_1st() {
|
||||
Instance = Noop;
|
||||
String[] rv = ((Gfo_usr_dlg__gui_mock)test__list.Gui_wkr()).Warns().To_str_ary_and_clear();
|
||||
String[] rv = ((Gfo_usr_dlg__gui_mock)test__list.Gui_wkr()).Warns().ToStrAryAndClear();
|
||||
return rv.length == 0 ? "" : rv[0];
|
||||
}
|
||||
public static void Test__show__init() {
|
||||
|
@ -27,7 +27,7 @@ public class Gfo_usr_dlg__log_base implements Gfo_usr_dlg__log {
|
||||
public Io_url Session_dir() {return session_dir;} private Io_url session_dir;
|
||||
public Io_url Session_fil() {return session_fil;} private Io_url session_fil;
|
||||
private void Flush() {
|
||||
int queued_len = queued_list.Count();
|
||||
int queued_len = queued_list.Len();
|
||||
for (int i = 0; i < queued_len; i++) {
|
||||
Usr_log_fil fil = (Usr_log_fil)queued_list.Get_at(i);
|
||||
if (fil.Url() == null) {
|
||||
@ -95,7 +95,7 @@ public class Gfo_usr_dlg__log_base implements Gfo_usr_dlg__log {
|
||||
synchronized (thread_lock) { // THREAD:synchronized neded b/c queued_list can be accessible by multiple threads; ISSUE#:646; DATE:2020-01-09
|
||||
if (queue_enabled) {
|
||||
String url_raw = url == null ? "mem" : url.Raw();
|
||||
Usr_log_fil fil = (Usr_log_fil)queued_list.Get_by(url_raw);
|
||||
Usr_log_fil fil = (Usr_log_fil)queued_list.GetByOrNull(url_raw);
|
||||
if (fil == null) {
|
||||
fil = new Usr_log_fil(url);
|
||||
queued_list.Add(url_raw, fil);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
Copyright (C) 2012-2021 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.
|
||||
@ -13,18 +13,18 @@ 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;
|
||||
package gplx;
|
||||
public interface Hash_adp extends gplx.core.lists.EnumerAble {
|
||||
int Count();
|
||||
boolean Has(Object key);
|
||||
Object Get_by(Object key);
|
||||
Object Get_by_or_fail(Object key);
|
||||
void Add(Object key, Object val);
|
||||
Hash_adp Add_and_more(Object key, Object val);
|
||||
Hash_adp Add_many_as_key_and_val(Object... ary);
|
||||
void Add_as_key_and_val(Object val);
|
||||
boolean Add_if_dupe_use_1st(Object key, Object val);
|
||||
void Add_if_dupe_use_nth(Object key, Object val);
|
||||
void Del(Object key);
|
||||
void Clear();
|
||||
}
|
||||
int Len();
|
||||
boolean Has(Object key);
|
||||
Object GetByOrNull(Object key);
|
||||
Object GetByOrFail(Object key);
|
||||
void Add(Object key, Object val);
|
||||
Hash_adp AddAndMore(Object key, Object val);
|
||||
Hash_adp AddManyAsKeyAndVal(Object... ary);
|
||||
void AddAsKeyAndVal(Object val);
|
||||
boolean AddIfDupeUse1st(Object key, Object val);
|
||||
void AddIfDupeUseNth(Object key, Object val);
|
||||
void Del(Object key);
|
||||
void Clear();
|
||||
}
|
||||
|
@ -21,16 +21,16 @@ public class Hash_adp_ {
|
||||
}
|
||||
class Hash_adp_obj extends gplx.core.lists.Hash_adp_base implements Hash_adp {}//_20110428
|
||||
class Hash_adp_noop implements Hash_adp {
|
||||
public int Count() {return 0;}
|
||||
public int Len() {return 0;}
|
||||
public boolean Has(Object key) {return false;}
|
||||
public Object Get_by(Object key) {return null;}
|
||||
public Object Get_by_or_fail(Object key) {throw Err_.new_missing_key(Object_.Xto_str_strict_or_null_mark(key));}
|
||||
public Object GetByOrNull(Object key) {return null;}
|
||||
public Object GetByOrFail(Object key) {throw Err_.new_missing_key(Object_.Xto_str_strict_or_null_mark(key));}
|
||||
public void Add(Object key, Object val) {}
|
||||
public Hash_adp Add_and_more(Object key, Object val) {return this;}
|
||||
public Hash_adp Add_many_as_key_and_val(Object... ary) {return this;}
|
||||
public void Add_as_key_and_val(Object val) {}
|
||||
public void Add_if_dupe_use_nth(Object key, Object val) {}
|
||||
public boolean Add_if_dupe_use_1st(Object key, Object val) {return false;}
|
||||
public Hash_adp AddAndMore(Object key, Object val) {return this;}
|
||||
public Hash_adp AddManyAsKeyAndVal(Object... ary) {return this;}
|
||||
public void AddAsKeyAndVal(Object val) {}
|
||||
public void AddIfDupeUseNth(Object key, Object val) {}
|
||||
public boolean AddIfDupeUse1st(Object key, Object val) {return false;}
|
||||
public void Del(Object key) {}
|
||||
public void Clear() {}
|
||||
public java.util.Iterator iterator() {return gplx.core.lists.Iterator_null.Instance;}
|
||||
|
@ -49,7 +49,7 @@ class Hash_adp_bry_fxt {
|
||||
public Hash_adp_bry_fxt New_cs() {hash = Hash_adp_bry.cs(); return this;}
|
||||
public Hash_adp_bry_fxt New_ci() {hash = Hash_adp_bry.ci_a7(); return this;}
|
||||
public Hash_adp_bry_fxt Add(String key) {byte[] key_bry = Bry_.new_u8(key); hash.Add(key_bry, key_bry); return this;}
|
||||
public Hash_adp_bry_fxt Count_tst(int expd) {Tfds.Eq(expd, hash.Count()); return this;}
|
||||
public Hash_adp_bry_fxt Count_tst(int expd) {Tfds.Eq(expd, hash.Len()); return this;}
|
||||
public Hash_adp_bry_fxt Get_bry_tst(String key) {return Get_bry_tst(key, key);}
|
||||
public Hash_adp_bry_fxt Get_bry_tst(String key, String expd) {
|
||||
byte[] key_bry = Bry_.new_u8(key);
|
||||
|
@ -162,13 +162,13 @@ public class Io_mgr implements Gfo_evt_mgr_owner { // exists primarily to gather
|
||||
class Io_mgr_ {
|
||||
public static int Delete_dir_empty(Io_url url) {
|
||||
IoItmDir dir = Io_mgr.Instance.QueryDir_args(url).ExecAsDir();
|
||||
int sub_dirs_len = dir.SubDirs().Count();
|
||||
int sub_dirs_len = dir.SubDirs().Len();
|
||||
int deleted_dirs = 0;
|
||||
for (int i = 0; i < sub_dirs_len; ++i) {
|
||||
IoItmDir sub_dir = (IoItmDir)dir.SubDirs().Get_at(i);
|
||||
deleted_dirs += Io_mgr.Instance.Delete_dir_empty(sub_dir.Url());
|
||||
}
|
||||
if ( dir.SubFils().Count() == 0
|
||||
if ( dir.SubFils().Len() == 0
|
||||
&& deleted_dirs == sub_dirs_len
|
||||
) {
|
||||
Io_mgr.Instance.DeleteDirIfEmpty(url);
|
||||
|
@ -16,19 +16,19 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
package gplx;
|
||||
public class Keyval_hash {
|
||||
private final Ordered_hash hash = Ordered_hash_.New();
|
||||
public int Count() {return hash.Count();}
|
||||
public int Len() {return hash.Count();}
|
||||
public int Count() {return hash.Len();}
|
||||
public int Len() {return hash.Len();}
|
||||
public Keyval_hash Clear() {hash.Clear(); return this;}
|
||||
public boolean Has(String key) {return hash.Has(key);}
|
||||
public Keyval Get_at(int i) {return (Keyval)hash.Get_at(i);}
|
||||
public Object Get_val_or(String key, Object or) {Keyval rv = Get_kvp_or_null(key); return rv == null ? or : rv.Val();}
|
||||
public Object Get_val_or_null(String key) {return Get_val_or(key, null);}
|
||||
public Object Get_val_or_fail(String key) {return Keyval_.as_(hash.Get_by_or_fail(key)).Val();}
|
||||
public Object Get_val_or_fail(String key) {return Keyval_.as_(hash.GetByOrFail(key)).Val();}
|
||||
public String Get_val_as_str_or_fail(String key) {return (String)Get_val_or_fail(key);}
|
||||
public Keyval Get_kvp_or_null(String key) {return Keyval_.as_(hash.Get_by(key));}
|
||||
public Keyval Get_kvp_or_null(String key) {return Keyval_.as_(hash.GetByOrNull(key));}
|
||||
public Keyval_hash Add(Keyval kv) {hash.Add(kv.Key(), kv); return this;}
|
||||
public Keyval_hash Add(String key, Object val) {hash.Add(key, Keyval_.new_(key, val)); return this;}
|
||||
public Keyval_hash Add_if_dupe_use_nth(String key, Object val) {hash.Add_if_dupe_use_nth(key, Keyval_.new_(key, val)); return this;}
|
||||
public Keyval_hash Add_if_dupe_use_nth(String key, Object val) {hash.AddIfDupeUseNth(key, Keyval_.new_(key, val)); return this;}
|
||||
public void Del(String key) {hash.Del(key);}
|
||||
public Keyval[] To_ary() {
|
||||
int len = this.Count();
|
||||
|
@ -15,14 +15,14 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx;
|
||||
public class Keyval_list {
|
||||
public int Count() {return list.Count();} private final List_adp list = List_adp_.New();
|
||||
public int Count() {return list.Len();} private final List_adp list = List_adp_.New();
|
||||
public void Clear() {list.Clear();}
|
||||
public Keyval Get_at(int i) {return (Keyval)list.Get_at(i);}
|
||||
public Keyval_list Add(String key, Object val) {list.Add(Keyval_.new_(key, val)); return this;}
|
||||
public Keyval[] To_ary() {return (Keyval[])list.To_ary(Keyval.class);}
|
||||
public Keyval[] To_ary() {return (Keyval[])list.ToAry(Keyval.class);}
|
||||
public String To_str() {
|
||||
Bry_bfr bfr = Bry_bfr_.New();
|
||||
int len = list.Count();
|
||||
int len = list.Len();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Keyval kv = (Keyval)list.Get_at(i);
|
||||
if (i == 0) bfr.Add_byte_space();
|
||||
|
@ -1,43 +1,43 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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;
|
||||
import gplx.core.lists.*; /*EnumerAble,ComparerAble*/
|
||||
public interface List_adp extends EnumerAble, List_adp__getable {
|
||||
int Count();
|
||||
Object Get_at_last();
|
||||
int Len();
|
||||
Object GetAtLast();
|
||||
void Add(Object o);
|
||||
void Add_at(int i, Object o);
|
||||
void Add_many(Object... ary);
|
||||
void AddAt(int i, Object o);
|
||||
void AddMany(Object... ary);
|
||||
void Del(Object o);
|
||||
void Del_at(int i);
|
||||
void Del_range(int bgn, int end);
|
||||
void DelAt(int i);
|
||||
void DelRange(int bgn, int end);
|
||||
void Clear();
|
||||
int Idx_of(Object o);
|
||||
int Idx_last();
|
||||
Object To_ary(Class<?> memberType);
|
||||
Object To_ary_and_clear(Class<?> memberType);
|
||||
String[] To_str_ary();
|
||||
String[] To_str_ary_and_clear();
|
||||
String To_str();
|
||||
Object[] To_obj_ary();
|
||||
void Resize_bounds(int i);
|
||||
void Move_to(int src, int trg);
|
||||
int IdxOf(Object o);
|
||||
int IdxLast();
|
||||
Object ToAry(Class<?> memberType);
|
||||
Object ToAryAndClear(Class<?> memberType);
|
||||
String[] ToStrAry();
|
||||
String[] ToStrAryAndClear();
|
||||
String ToStr();
|
||||
Object[] ToObjAry();
|
||||
void ResizeBounds(int i);
|
||||
void MoveTo(int src, int trg);
|
||||
void Reverse();
|
||||
void Sort();
|
||||
void Sort_by(ComparerAble comparer);
|
||||
void SortBy(ComparerAble comparer);
|
||||
void Shuffle();
|
||||
}
|
||||
class List_adp_obj extends List_adp_base implements List_adp {
|
||||
@ -45,31 +45,30 @@ class List_adp_obj extends List_adp_base implements List_adp {
|
||||
public List_adp_obj(int v) {super(v);}
|
||||
}
|
||||
class List_adp_noop implements List_adp {
|
||||
public int Count() {return 0;}
|
||||
public int Len() {return 0;}
|
||||
public Object Get_at(int i) {return null;}
|
||||
public Object Get_at_last() {return null;}
|
||||
public Object GetAtLast() {return null;}
|
||||
public Object PopLast() {return null;}
|
||||
public void Add(Object o) {}
|
||||
public void Add_at(int i, Object o) {}
|
||||
public void Add_many(Object... ary) {}
|
||||
public void AddAt(int i, Object o) {}
|
||||
public void AddMany(Object... ary) {}
|
||||
public void Del(Object o) {}
|
||||
public void Del_at(int i) {}
|
||||
public void Del_range(int bgn, int end) {}
|
||||
public void DelAt(int i) {}
|
||||
public void DelRange(int bgn, int end) {}
|
||||
public void Clear() {}
|
||||
public int Idx_last() {return -1;}
|
||||
public int Idx_of(Object o) {return List_adp_.Not_found;}
|
||||
public void Move_to(int elemPos, int newPos) {}
|
||||
public void Resize_bounds(int i) {}
|
||||
public Object To_ary(Class<?> memberType) {return Object_.Ary_empty;}
|
||||
public Object To_ary_and_clear(Class<?> memberType) {return Object_.Ary_empty;}
|
||||
public String[] To_str_ary() {return String_.Ary_empty;}
|
||||
public String[] To_str_ary_and_clear() {return To_str_ary();}
|
||||
public String To_str() {return "";}
|
||||
public Object[] To_obj_ary() {return Object_.Ary_empty;}
|
||||
public int IdxLast() {return -1;}
|
||||
public int IdxOf(Object o) {return List_adp_.Not_found;}
|
||||
public void MoveTo(int elemPos, int newPos) {}
|
||||
public void ResizeBounds(int i) {}
|
||||
public Object ToAry(Class<?> memberType) {return Object_.Ary_empty;}
|
||||
public Object ToAryAndClear(Class<?> memberType) {return Object_.Ary_empty;}
|
||||
public String[] ToStrAry() {return String_.Ary_empty;}
|
||||
public String[] ToStrAryAndClear() {return ToStrAry();}
|
||||
public String ToStr() {return "";}
|
||||
public Object[] ToObjAry() {return Object_.Ary_empty;}
|
||||
public java.util.Iterator iterator() {return Iterator_null.Instance;}
|
||||
public void Reverse() {}
|
||||
public void Sort() {}
|
||||
public void Sort_by(ComparerAble comparer) {}
|
||||
public void SortBy(ComparerAble comparer) {}
|
||||
public void Shuffle() {}
|
||||
}
|
||||
|
@ -14,39 +14,38 @@ 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;
|
||||
import gplx.core.lists.*;
|
||||
public class List_adp_ {
|
||||
public static final List_adp Noop = new List_adp_noop();
|
||||
public static List_adp New() {return new List_adp_obj();}
|
||||
public static List_adp New_w_size(int v) {return new List_adp_obj(v);}
|
||||
public static List_adp New_by_many(Object... ary) {
|
||||
List_adp rv = new List_adp_obj();
|
||||
rv.Add_many(ary);
|
||||
rv.AddMany(ary);
|
||||
return rv;
|
||||
}
|
||||
public static void Del_at_last(List_adp list) {list.Del_at(list.Count() - 1);}
|
||||
public static void Del_at_last(List_adp list) {list.DelAt(list.Len() - 1);}
|
||||
public static Object Pop(List_adp list) {
|
||||
int lastIdx = list.Count() - 1;
|
||||
int lastIdx = list.Len() - 1;
|
||||
Object rv = list.Get_at(lastIdx);
|
||||
list.Del_at(lastIdx);
|
||||
list.DelAt(lastIdx);
|
||||
return rv;
|
||||
}
|
||||
public static Object Pop_first(List_adp list) { // NOTE: dirty way of implementing FIFO queue; should not be used with lists with many members
|
||||
Object rv = list.Get_at(0);
|
||||
list.Del_at(0);
|
||||
list.DelAt(0);
|
||||
return rv;
|
||||
}
|
||||
public static Object Pop_last(List_adp list) {
|
||||
int last_idx = list.Count() - 1;
|
||||
int last_idx = list.Len() - 1;
|
||||
Object rv = list.Get_at(last_idx);
|
||||
list.Del_at(last_idx);
|
||||
list.DelAt(last_idx);
|
||||
return rv;
|
||||
}
|
||||
public static Object Pop_or(List_adp list, Object or) {
|
||||
int list_len = list.Count(); if (list_len == 0) return or;
|
||||
int list_len = list.Len(); if (list_len == 0) return or;
|
||||
int last_idx = list_len - 1;
|
||||
Object rv = list.Get_at(last_idx);
|
||||
list.Del_at(last_idx);
|
||||
list.DelAt(last_idx);
|
||||
return rv;
|
||||
}
|
||||
public static final int Not_found = -1, Base1 = 1;
|
||||
|
@ -14,7 +14,10 @@ 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;
|
||||
import gplx.core.strings.*; import gplx.core.lists.*;
|
||||
import gplx.core.lists.ComparerAble;
|
||||
import gplx.core.lists.Iterator_null;
|
||||
import gplx.core.lists.Iterator_objAry;
|
||||
import gplx.core.lists.List_adp_sorter;
|
||||
public abstract class List_adp_base implements List_adp, Gfo_invk {
|
||||
private Object[] list; private int count;
|
||||
public List_adp_base(int capacity) {
|
||||
@ -26,10 +29,9 @@ public abstract class List_adp_base implements List_adp, Gfo_invk {
|
||||
else
|
||||
return new Iterator_objAry(list, count);
|
||||
}
|
||||
public void Add_many(Object... ary) {for (Object o : ary) Add_base(o);}
|
||||
public void AddMany(Object... ary) {for (Object o : ary) Add_base(o);}
|
||||
public int Len() {return count;}
|
||||
public int Count() {return count;}
|
||||
public int Idx_last() {return count - 1;}
|
||||
public int IdxLast() {return count - 1;}
|
||||
protected Object Get_at_base(int index) {if (index >= count || index < 0) throw Err_.new_missing_idx(index, count);
|
||||
return list[index];
|
||||
}
|
||||
@ -40,10 +42,10 @@ public abstract class List_adp_base implements List_adp, Gfo_invk {
|
||||
}
|
||||
protected int Del_base(Object o) {
|
||||
int index = IndexOf_base(o); if (index == List_adp_.Not_found) return List_adp_.Not_found;
|
||||
this.Del_at(index);
|
||||
this.DelAt(index);
|
||||
return index;
|
||||
}
|
||||
public void Del_range(int delBgn, int delEnd) {
|
||||
public void DelRange(int delBgn, int delEnd) {
|
||||
BoundsChk(delBgn, delEnd, count);
|
||||
if (delBgn == 0 && delEnd == count - 1) { // entire list deleted; call .Clear, else will have 0 elem array
|
||||
this.Clear();
|
||||
@ -69,11 +71,11 @@ public abstract class List_adp_base implements List_adp, Gfo_invk {
|
||||
list[i] = null;
|
||||
count = 0;
|
||||
}
|
||||
public void Del_at(int index) {if (index >= count || index < 0) throw Err_.new_missing_idx(index, count);
|
||||
public void DelAt(int index) {if (index >= count || index < 0) throw Err_.new_missing_idx(index, count);
|
||||
Collapse(index);
|
||||
count--;
|
||||
}
|
||||
public void Move_to(int src, int trg) {if (src >= count || src < 0) throw Err_.new_missing_idx(src, count); if (trg >= count || trg < 0) throw Err_.new_missing_idx(trg, count);
|
||||
public void MoveTo(int src, int trg) {if (src >= count || src < 0) throw Err_.new_missing_idx(src, count); if (trg >= count || trg < 0) throw Err_.new_missing_idx(trg, count);
|
||||
if (src == trg) return; // position not changed
|
||||
Object o = list[src];
|
||||
int dif = trg > src ? 1 : -1;
|
||||
@ -88,11 +90,11 @@ public abstract class List_adp_base implements List_adp, Gfo_invk {
|
||||
list[pos] = o;
|
||||
count = count + 1;
|
||||
}
|
||||
public void Resize_bounds(int i) {
|
||||
public void ResizeBounds(int i) {
|
||||
Resize_expand(i);
|
||||
}
|
||||
public void Sort() {Sort_by(null);}
|
||||
public void Sort_by(ComparerAble comparer) {List_adp_sorter.new_().Sort(list, count, true, comparer);}
|
||||
public void Sort() {SortBy(null);}
|
||||
public void SortBy(ComparerAble comparer) {List_adp_sorter.new_().Sort(list, count, true, comparer);}
|
||||
public void Reverse() {
|
||||
int mid = count / 2; // no need to reverse pivot; ex: for 3 elements, only 1 and 3 need to be exchanged; 2 stays inplace
|
||||
for (int lhs = 0; lhs < mid; lhs++) {
|
||||
@ -112,31 +114,31 @@ public abstract class List_adp_base implements List_adp, Gfo_invk {
|
||||
}
|
||||
}
|
||||
public Object Get_at(int i) {return Get_at_base(i);}
|
||||
public Object Get_at_last() {if (count == 0) throw Err_.new_invalid_op("cannot call Get_at_last on empty list"); return Get_at_base(count - 1);}
|
||||
public Object GetAtLast() {if (count == 0) throw Err_.new_invalid_op("cannot call Get_at_last on empty list"); return Get_at_base(count - 1);}
|
||||
public void Add(Object item) {Add_base(item);}
|
||||
public void Add_at(int i, Object o) {AddAt_base(i, o);}
|
||||
public void AddAt(int i, Object o) {AddAt_base(i, o);}
|
||||
public void Del(Object item) {Del_base(item);}
|
||||
public int Idx_of(Object o) {return IndexOf_base(o);}
|
||||
public int IdxOf(Object o) {return IndexOf_base(o);}
|
||||
public List_adp_base() {
|
||||
list = new Object[Len_initial];
|
||||
}
|
||||
private static final int Len_initial = 8;
|
||||
public Object To_ary_and_clear(Class<?> memberType) {Object rv = To_ary(memberType); this.Clear(); return rv;}
|
||||
public Object To_ary(Class<?> memberType) {
|
||||
public Object ToAryAndClear(Class<?> memberType) {Object rv = ToAry(memberType); this.Clear(); return rv;}
|
||||
public Object ToAry(Class<?> memberType) {
|
||||
Object rv = Array_.Create(memberType, count);
|
||||
for (int i = 0; i < count; i++)
|
||||
Array_.Set_at(rv, i, list[i]);
|
||||
return rv;
|
||||
}
|
||||
public String[] To_str_ary_and_clear() {String[] rv = To_str_ary(); this.Clear(); return rv;}
|
||||
public String[] To_str_ary() {return (String[])To_ary(String.class);}
|
||||
public Object[] To_obj_ary() {
|
||||
public String[] ToStrAryAndClear() {String[] rv = ToStrAry(); this.Clear(); return rv;}
|
||||
public String[] ToStrAry() {return (String[])ToAry(String.class);}
|
||||
public Object[] ToObjAry() {
|
||||
Object[] rv = new Object[count];
|
||||
for (int i = 0; i < count; ++i)
|
||||
rv[i] = list[i];
|
||||
return rv;
|
||||
}
|
||||
public String To_str() {
|
||||
public String ToStr() {
|
||||
Bry_bfr bfr = Bry_bfr_.New();
|
||||
for (int i = 0; i < count; ++i)
|
||||
bfr.Add_str_u8(Object_.Xto_str_strict_or_null_mark(list[i])).Add_byte_nl();
|
||||
|
@ -21,20 +21,20 @@ public class List_adp_tst {
|
||||
listBase = (List_adp_base)list;
|
||||
} List_adp list; List_adp_base listBase;
|
||||
@Test public void Add() {
|
||||
Tfds.Eq(0, list.Count());
|
||||
Tfds.Eq(0, list.Len());
|
||||
|
||||
list.Add("0");
|
||||
Tfds.Eq(1, list.Count());
|
||||
Tfds.Eq(1, list.Len());
|
||||
}
|
||||
@Test public void Add_changeCapacity() {
|
||||
int capacity = 8;
|
||||
for (int i = 0; i < capacity; i++)
|
||||
list.Add("0");
|
||||
Tfds.Eq(capacity, list.Count());
|
||||
Tfds.Eq(capacity, list.Len());
|
||||
Tfds.Eq(capacity, listBase.Capacity());
|
||||
|
||||
list.Add(capacity); // forces resize
|
||||
Tfds.Eq(capacity + 1, list.Count());
|
||||
Tfds.Eq(capacity + 1, list.Len());
|
||||
Tfds.Eq(capacity * 2, listBase.Capacity());
|
||||
}
|
||||
@Test public void Get_at() {
|
||||
@ -55,42 +55,42 @@ public class List_adp_tst {
|
||||
}
|
||||
@Test public void Del_at() {
|
||||
list.Add("0");
|
||||
Tfds.Eq(1, list.Count());
|
||||
Tfds.Eq(1, list.Len());
|
||||
|
||||
list.Del_at(0);
|
||||
Tfds.Eq(0, list.Count());
|
||||
list.DelAt(0);
|
||||
Tfds.Eq(0, list.Len());
|
||||
}
|
||||
@Test public void DelAt_shiftDown() {
|
||||
list_AddMany("0", "1");
|
||||
Tfds.Eq(list.Count(), 2);
|
||||
Tfds.Eq(list.Len(), 2);
|
||||
|
||||
list.Del_at(0);
|
||||
Tfds.Eq(1, list.Count());
|
||||
list.DelAt(0);
|
||||
Tfds.Eq(1, list.Len());
|
||||
Tfds.Eq("1", list.Get_at(0));
|
||||
}
|
||||
@Test public void DelAt_fail() {
|
||||
try {list.Del_at(0);}
|
||||
try {list.DelAt(0);}
|
||||
catch (Exception exc) {Err_.Noop(exc); return;}
|
||||
Tfds.Fail("Del_at should fail for out of bound index");
|
||||
}
|
||||
@Test public void Del() {
|
||||
list.Add("0");
|
||||
Tfds.Eq(1, list.Count());
|
||||
Tfds.Eq(1, list.Len());
|
||||
|
||||
list.Del("0");
|
||||
Tfds.Eq(0, list.Count());
|
||||
Tfds.Eq(0, list.Len());
|
||||
}
|
||||
@Test public void Del_matchMember() {
|
||||
list_AddMany("0", "1");
|
||||
Tfds.Eq(2, list.Count());
|
||||
Tfds.Eq(2, list.Len());
|
||||
|
||||
list.Del("1");
|
||||
Tfds.Eq(1, list.Count());
|
||||
Tfds.Eq(1, list.Len());
|
||||
Tfds.Eq("0", list.Get_at(0));
|
||||
}
|
||||
@Test public void Del_matchFirst() {
|
||||
list_AddMany("0", "1", "0");
|
||||
Tfds.Eq(3, list.Count());
|
||||
Tfds.Eq(3, list.Len());
|
||||
|
||||
list.Del("0");
|
||||
tst_Enumerator("1", "0");
|
||||
@ -120,12 +120,12 @@ public class List_adp_tst {
|
||||
Tfds.Eq(capacity * 2, listBase.Capacity());
|
||||
|
||||
list.Clear();
|
||||
Tfds.Eq(0, list.Count());
|
||||
Tfds.Eq(0, list.Len());
|
||||
Tfds.Eq(16, listBase.Capacity()); // check that capacity has increased
|
||||
}
|
||||
@Test public void Clear_empty() { // confirm no failure
|
||||
list.Clear();
|
||||
Tfds.Eq(0, list.Count());
|
||||
Tfds.Eq(0, list.Len());
|
||||
}
|
||||
@Test public void Reverse() {
|
||||
list_AddMany("0", "1", "2");
|
||||
@ -143,12 +143,12 @@ public class List_adp_tst {
|
||||
@Test public void Sort_empty() {list.Sort();}
|
||||
@Test public void Xto_bry() {
|
||||
list_AddMany("0", "1");
|
||||
String[] ary = (String[])list.To_ary(String.class);
|
||||
String[] ary = (String[])list.ToAry(String.class);
|
||||
Tfds.Eq_nullNot(ary);
|
||||
Tfds.Eq(2, Array_.Len(ary));
|
||||
}
|
||||
@Test public void XtoAry_empty() {
|
||||
String[] ary = (String[])list.To_ary(String.class);
|
||||
String[] ary = (String[])list.ToAry(String.class);
|
||||
Tfds.Eq_nullNot(ary);
|
||||
Tfds.Eq(0, Array_.Len(ary));
|
||||
}
|
||||
@ -158,16 +158,16 @@ public class List_adp_tst {
|
||||
|
||||
list.Shuffle();
|
||||
int hasMovedCount = 0;
|
||||
for (int i = 0; i < list.Count(); i++) {
|
||||
for (int i = 0; i < list.Len(); i++) {
|
||||
int val = Int_.Cast(list.Get_at(i));
|
||||
if (val != i) hasMovedCount++;
|
||||
}
|
||||
Tfds.Eq_true(hasMovedCount > 0, "all documents have the same index"); // NOTE: may still fail occasionally (1%)
|
||||
|
||||
int count = list.Count();
|
||||
int count = list.Len();
|
||||
for (int i = 0; i < count; i++)
|
||||
list.Del(i);
|
||||
Tfds.Eq(0, list.Count(), "shuffled list does not have the same contents as original list");
|
||||
Tfds.Eq(0, list.Len(), "shuffled list does not have the same contents as original list");
|
||||
}
|
||||
@Test public void Shuffle_empty() {list.Shuffle();}
|
||||
@Test public void Move_to() {
|
||||
@ -185,8 +185,8 @@ public class List_adp_tst {
|
||||
run_ClearAndAdd("0", "1", "2", "3").tst_DelRange(0, 0, "1", "2", "3");
|
||||
}
|
||||
void tst_DelRange(int bgn, int end, String... expd) {
|
||||
list.Del_range(bgn, end);
|
||||
Tfds.Eq_ary_str(expd, list.To_str_ary());
|
||||
list.DelRange(bgn, end);
|
||||
Tfds.Eq_ary_str(expd, list.ToStrAry());
|
||||
}
|
||||
List_adp_tst run_ClearAndAdd(String... ary) {
|
||||
list.Clear();
|
||||
@ -196,9 +196,9 @@ public class List_adp_tst {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
List_adp_tst run_MoveTo(int elemPos, int newPos) {list.Move_to(elemPos, newPos); return this;}
|
||||
List_adp_tst run_MoveTo(int elemPos, int newPos) {list.MoveTo(elemPos, newPos); return this;}
|
||||
List_adp_tst tst_Order(String... expd) {
|
||||
String[] actl = (String[])list.To_ary(String.class);
|
||||
String[] actl = (String[])list.ToAry(String.class);
|
||||
Tfds.Eq_ary(expd, actl);
|
||||
return this;
|
||||
}
|
||||
|
@ -31,25 +31,25 @@ public class Ordered_hash_base extends Hash_adp_base implements Ordered_hash, Gf
|
||||
AssertCounts("Del", key);
|
||||
}
|
||||
protected Object Get_at_base(int index) {return ordered.Get_at(index);}
|
||||
protected int IndexOf_base(Object obj) {return ordered.Idx_of(obj);}
|
||||
protected int IndexOf_base(Object obj) {return ordered.IdxOf(obj);}
|
||||
@Override public void Clear() {
|
||||
if (locked) Lock_fail();
|
||||
super.Clear();
|
||||
ordered.Clear();
|
||||
}
|
||||
public Object To_ary(Class<?> type) {return ordered.To_ary(type);}
|
||||
public Object To_ary(Class<?> type) {return ordered.ToAry(type);}
|
||||
public Object To_ary_and_clear(Class<?> t) {
|
||||
Object rv = To_ary(t);
|
||||
this.Clear();
|
||||
return rv;
|
||||
}
|
||||
public void Sort() {if (locked) Lock_fail(); ordered.Sort();} // NOTE: uses item's .compareTo
|
||||
public void Sort_by(ComparerAble comparer) {if (locked) Lock_fail(); ordered.Sort_by(comparer);}
|
||||
public void Sort_by(ComparerAble comparer) {if (locked) Lock_fail(); ordered.SortBy(comparer);}
|
||||
@Override public java.util.Iterator iterator() {return ordered.iterator();}
|
||||
public void Add_at(int i, Object key, Object val) {
|
||||
if (locked) Lock_fail();
|
||||
super.Add_base(key, val);
|
||||
ordered.Add_at(i, val);
|
||||
ordered.AddAt(i, val);
|
||||
AssertCounts("Add_at", key);
|
||||
}
|
||||
public Ordered_hash Add_many_str(String... ary) {
|
||||
@ -62,19 +62,19 @@ public class Ordered_hash_base extends Hash_adp_base implements Ordered_hash, Gf
|
||||
return this;
|
||||
}
|
||||
private void AssertCounts(String proc, Object key) {
|
||||
if (super.Count() != ordered.Count()) throw Err_.new_wo_type("counts do not match; same key is either added twice, or delete failed", "proc", proc, "key", Object_.Xto_str_strict_or_null_mark(key), "hash", super.Count(), "list", ordered.Count());
|
||||
if (super.Len() != ordered.Len()) throw Err_.new_wo_type("counts do not match; same key is either added twice, or delete failed", "proc", proc, "key", Object_.Xto_str_strict_or_null_mark(key), "hash", super.Len(), "list", ordered.Len());
|
||||
}
|
||||
public void Resize_bounds(int i) {if (locked) Lock_fail(); ordered.Resize_bounds(i);}
|
||||
public void Resize_bounds(int i) {if (locked) Lock_fail(); ordered.ResizeBounds(i);}
|
||||
public void Lock() {locked = true;} private boolean locked = false;
|
||||
void Lock_fail() {throw Err_.new_wo_type("collection is locked");}
|
||||
static final String GRP_KEY = "gplx.core.lists.ordered_hash";
|
||||
public void Add_at(int i, Object o) {if (locked) Lock_fail(); ordered.Add_at(i, o);}
|
||||
public void Add_at(int i, Object o) {if (locked) Lock_fail(); ordered.AddAt(i, o);}
|
||||
public Object Get_at(int i) {return Get_at_base(i);}
|
||||
public int Idx_of(Object obj) {return this.IndexOf_base(obj);}
|
||||
public void Move_to(int src, int trg) {if (locked) Lock_fail(); ordered.Move_to(src, trg);}
|
||||
public void Move_to(int src, int trg) {if (locked) Lock_fail(); ordered.MoveTo(src, trg);}
|
||||
private String To_str_ui() {
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
int count = ordered.Count();
|
||||
int count = ordered.Len();
|
||||
int pad = String_.Len(Int_.To_str(count));
|
||||
for (int i = 0; i < count; i++) {
|
||||
sb .Add(Int_.To_str_pad_bgn_zero(i, pad))
|
||||
@ -96,6 +96,6 @@ public class Ordered_hash_base extends Hash_adp_base implements Ordered_hash, Gf
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
} static final String Invk_SetKeyOnly = "SetKeyOnly", Invk_Print = "Print";
|
||||
@Override public int Count() {return ordered.Count();}
|
||||
@Override public int Len() {return ordered.Len();}
|
||||
public Ordered_hash_base() {}
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ public class String_ {
|
||||
if (itm == null) continue;
|
||||
list.Add(itm);
|
||||
}
|
||||
return list.To_str_ary();
|
||||
return list.ToStrAry();
|
||||
}
|
||||
public static String AryXtoStr(String... ary) {
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
@ -431,7 +431,7 @@ public class String_ {
|
||||
}
|
||||
if (sb.Count() > 0)
|
||||
list.Add(sb.To_str_and_clear());
|
||||
return list.To_str_ary();
|
||||
return list.ToStrAry();
|
||||
}
|
||||
public static String[] Split(String s, String separator) {return Split_do(s, separator, false);}
|
||||
public static String[] SplitLines_crlf(String s) {return Split(s, Op_sys.Wnt.Nl_str());}
|
||||
@ -476,7 +476,7 @@ public class String_ {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return (String[])list.To_ary(String.class);
|
||||
return (String[])list.ToAry(String.class);
|
||||
}
|
||||
static String Mid_lang(String s, int bgn, int len) {return s.substring(bgn, bgn + len);}
|
||||
public static String Extract_after_bwd(String src, String dlm) {
|
||||
@ -508,7 +508,7 @@ public class String_ {
|
||||
int len = filter.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
String itm = filter[i];
|
||||
hash.Add_if_dupe_use_nth(itm, itm);
|
||||
hash.AddIfDupeUseNth(itm, itm);
|
||||
}
|
||||
List_adp rv = List_adp_.New();
|
||||
len = src.length;
|
||||
@ -516,7 +516,7 @@ public class String_ {
|
||||
String itm = src[i];
|
||||
if (hash.Has(itm)) rv.Add(itm);
|
||||
}
|
||||
return rv.To_str_ary();
|
||||
return rv.ToStrAry();
|
||||
}
|
||||
public static String[] Ary_flatten(String[][] src_ary) {
|
||||
int trg_len = 0;
|
||||
|
@ -103,7 +103,7 @@ public class Tfds { // URL:doc/gplx.tfds/Tfds.txt
|
||||
}
|
||||
static void Eq_list_wkr(List_adp lhsList, List_adp rhsList, TfdsEqListItmStr xtoStr, String customMsg) {
|
||||
List_adp list = List_adp_.New(); boolean pass = true;
|
||||
int lhsLen = lhsList.Count(), rhsLen = rhsList.Count();
|
||||
int lhsLen = lhsList.Len(), rhsLen = rhsList.Len();
|
||||
for (int i = 0; i < lhsLen; i++) {
|
||||
Object lhs = lhsList.Get_at(i);
|
||||
Object rhs = i >= rhsLen ? null : rhsList.Get_at(i);
|
||||
@ -180,13 +180,13 @@ class TfdsMsgBldr {
|
||||
if (lhsAryLen != rhsAryLen)
|
||||
sb.Add_fmt_line("{0}element counts differ: {1} {2}", "\t\t", lhsAryLen, rhsAryLen);
|
||||
int lhsLenMax = 0, rhsLenMax = 0;
|
||||
for (int i = 0; i < list.Count(); i++) {
|
||||
for (int i = 0; i < list.Len(); i++) {
|
||||
TfdsEqAryItm itm = (TfdsEqAryItm)list.Get_at(i);
|
||||
int lhsLen = String_.Len(itm.Lhs()), rhsLen = String_.Len(itm.Rhs());
|
||||
if (lhsLen > lhsLenMax) lhsLenMax = lhsLen;
|
||||
if (rhsLen > rhsLenMax) rhsLenMax = rhsLen;
|
||||
}
|
||||
for (int i = 0; i < list.Count(); i++) {
|
||||
for (int i = 0; i < list.Len(); i++) {
|
||||
TfdsEqAryItm itm = (TfdsEqAryItm)list.Get_at(i);
|
||||
String eq_str = itm.Eq() ? "==" : "";
|
||||
if (!itm.Eq()) {
|
||||
|
@ -33,15 +33,15 @@ public class TfdsTstr_fxt {
|
||||
public void Fail() {
|
||||
manualFail = true;
|
||||
}boolean manualFail = false;
|
||||
public int List_Max(List_adp expd, List_adp actl) {return Math_.Max(expd.Count(), actl.Count());}
|
||||
public int List_Max(List_adp expd, List_adp actl) {return Math_.Max(expd.Len(), actl.Len());}
|
||||
public int List_Max(String[] expd, String[] actl) {return Math_.Max(expd.length, actl.length);}
|
||||
public Object List_FetchAtOrNull(List_adp l, int i) {return (i >= l.Count()) ? null : l.Get_at(i);}
|
||||
public Object List_FetchAtOrNull(List_adp l, int i) {return (i >= l.Len()) ? null : l.Get_at(i);}
|
||||
|
||||
public void SubName_pop() {stack.Pop();}
|
||||
int nameLenMax = 0;
|
||||
public void tst_Equal(String hdr) {
|
||||
boolean pass = true;
|
||||
for (int i = 0; i < list.Count(); i++) {
|
||||
for (int i = 0; i < list.Len(); i++) {
|
||||
TfdsTstrItm itm = (TfdsTstrItm)list.Get_at(i);
|
||||
if (!itm.Compare()) pass = false; // don't break early; Compare all vals
|
||||
}
|
||||
@ -49,7 +49,7 @@ public class TfdsTstr_fxt {
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
sb.Add_char_crlf();
|
||||
sb.Add_str_w_crlf(hdr);
|
||||
for (int i = 0; i < list.Count(); i++) {
|
||||
for (int i = 0; i < list.Len(); i++) {
|
||||
TfdsTstrItm itm = (TfdsTstrItm)list.Get_at(i);
|
||||
if (itm.TypeOf == 1) {
|
||||
sb.Add_fmt_line(" /{0}", itm.SubName());
|
||||
@ -77,7 +77,7 @@ class TfdsTstrItm {
|
||||
if (stack.Count() == 0) return;
|
||||
List_adp list = stack.XtoList();
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
for (int i = 0; i < list.Count(); i++) {
|
||||
for (int i = 0; i < list.Len(); i++) {
|
||||
if (i != 0) sb.Add(".");
|
||||
sb.Add((String)list.Get_at(i));
|
||||
}
|
||||
|
@ -1,21 +1,21 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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;
|
||||
import gplx.core.strings.*; import gplx.core.envs.*;
|
||||
public class UsrMsg {
|
||||
public class UsrMsg {
|
||||
public int VisibilityDuration() {return visibilityDuration;} public UsrMsg VisibilityDuration_(int v) {visibilityDuration = v; return this;} int visibilityDuration = 3000;
|
||||
public String Hdr() {return hdr;} public UsrMsg Hdr_(String val) {hdr = val; return this;} private String hdr;
|
||||
public Ordered_hash Args() {return args;} Ordered_hash args = Ordered_hash_.New();
|
||||
@ -24,7 +24,7 @@ public class UsrMsg {
|
||||
return this;
|
||||
}
|
||||
public UsrMsg Add_if_dupe_use_nth(String k, Object v) {
|
||||
args.Add_if_dupe_use_nth(k, Keyval_.new_(k, v));
|
||||
args.AddIfDupeUseNth(k, Keyval_.new_(k, v));
|
||||
return this;
|
||||
}
|
||||
public String XtoStrSingleLine() {return To_str(" ");}
|
||||
@ -32,7 +32,7 @@ public class UsrMsg {
|
||||
String To_str(String spr) {
|
||||
if (hdr == null) {
|
||||
GfoMsg m = GfoMsg_.new_cast_(cmd);
|
||||
for (int i = 0; i < args.Count(); i++) {
|
||||
for (int i = 0; i < args.Len(); i++) {
|
||||
Keyval kv = (Keyval)args.Get_at(i);
|
||||
m.Add(kv.Key(), kv.Val());
|
||||
}
|
||||
@ -40,7 +40,7 @@ public class UsrMsg {
|
||||
}
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
sb.Add(hdr).Add(spr);
|
||||
for (int i = 0; i < args.Count(); i++) {
|
||||
for (int i = 0; i < args.Len(); i++) {
|
||||
Keyval kv = (Keyval)args.Get_at(i);
|
||||
sb.Add_spr_unless_first("", " ", i);
|
||||
sb.Add_fmt("{0}={1}", kv.Key(), kv.Val(), spr);
|
||||
|
@ -1,25 +1,25 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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;
|
||||
public class UsrMsgWkr_mock implements UsrMsgWkr {
|
||||
public void ExecUsrMsg(int type, UsrMsg m) {
|
||||
msgs.Add(m);
|
||||
}
|
||||
public boolean HasWarn(UsrMsg um) {
|
||||
for (int i = 0; i < msgs.Count(); i++) {
|
||||
for (int i = 0; i < msgs.Len(); i++) {
|
||||
UsrMsg found = (UsrMsg)msgs.Get_at(i);
|
||||
if (String_.Eq(um.To_str(), found.To_str())) return true;
|
||||
}
|
||||
|
@ -13,8 +13,9 @@ 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.core.brys.fmtrs; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
|
||||
import gplx.core.brys.*; import gplx.core.primitives.*; import gplx.core.strings.*;
|
||||
package gplx.core.brys.fmtrs; import gplx.*;
|
||||
import gplx.core.brys.*;
|
||||
import gplx.core.primitives.*; import gplx.core.strings.*;
|
||||
public class Bry_fmtr {
|
||||
public byte[] Fmt() {return fmt;} private byte[] fmt = Bry_.Empty;
|
||||
public boolean Fmt_null() {return fmt.length == 0;}
|
||||
@ -136,7 +137,7 @@ public class Bry_fmtr {
|
||||
list.Add(Bry_fmtr_itm.arg_(lkp_bfr.To_int(0) - baseInt));
|
||||
else {
|
||||
byte[] key_fmt = lkp_bfr.To_bry();
|
||||
Object idx_ref = keys.Get_by(Bry_obj_ref.New(key_fmt));
|
||||
Object idx_ref = keys.GetByOrNull(Bry_obj_ref.New(key_fmt));
|
||||
if (idx_ref == null) {
|
||||
int lkp_bfr_len = lkp_bfr.Len();
|
||||
byte[] lkp_bry = lkp_bfr.Bfr();
|
||||
@ -210,7 +211,7 @@ public class Bry_fmtr {
|
||||
}
|
||||
if (lkp_is_active) throw Err_.new_wo_type("idx mode not closed");
|
||||
if (trg_pos > 0) {list.Add(Bry_fmtr_itm.dat_(trg_bry, trg_pos)); trg_pos = 0;}
|
||||
itms = (Bry_fmtr_itm[])list.To_ary(Bry_fmtr_itm.class);
|
||||
itms = (Bry_fmtr_itm[])list.ToAry(Bry_fmtr_itm.class);
|
||||
itms_len = itms.length;
|
||||
if (dirty_disable)
|
||||
dirty = false; // ISSUE#:575; DATE:2019-09-16
|
||||
|
@ -13,7 +13,7 @@ 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.core.brys.fmts; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
|
||||
package gplx.core.brys.fmts; import gplx.*;
|
||||
public class Bry_fmt_parser_ {
|
||||
public static Bry_fmt_itm[] Parse(byte escape, byte grp_bgn, byte grp_end, Bfr_fmt_arg[] args, byte[][] keys, byte[] src) {
|
||||
int src_len = src.length;
|
||||
@ -56,18 +56,18 @@ public class Bry_fmt_parser_ {
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
Bry_fmt_itm[] rv = (Bry_fmt_itm[])list.To_ary_and_clear(Bry_fmt_itm.class);
|
||||
Bry_fmt_itm[] rv = (Bry_fmt_itm[])list.ToAryAndClear(Bry_fmt_itm.class);
|
||||
int len = args.length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Bfr_fmt_arg arg = args[i];
|
||||
Bry_fmt_itm key_itm = (Bry_fmt_itm)keys_hash.Get_by(arg.Key); if (key_itm == null) continue;
|
||||
Bry_fmt_itm key_itm = (Bry_fmt_itm)keys_hash.GetByOrNull(arg.Key); if (key_itm == null) continue;
|
||||
key_itm.Tid = Bry_fmt_itm.Tid__arg;
|
||||
key_itm.Arg = arg.Arg;
|
||||
}
|
||||
len = keys.length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
byte[] key = keys[i];
|
||||
Bry_fmt_itm key_itm = (Bry_fmt_itm)keys_hash.Get_by(key); if (key_itm == null) continue; // NOTE: ignore missing keys; EX: fmt=a~{b}c keys=b,d; do not fail b/c ~{d} is not in fmt; allows redefining from tests
|
||||
Bry_fmt_itm key_itm = (Bry_fmt_itm)keys_hash.GetByOrNull(key); if (key_itm == null) continue; // NOTE: ignore missing keys; EX: fmt=a~{b}c keys=b,d; do not fail b/c ~{d} is not in fmt; allows redefining from tests
|
||||
key_itm.Key_idx = i;
|
||||
}
|
||||
return rv;
|
||||
|
@ -13,7 +13,7 @@ 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.core.caches; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.caches; import gplx.*;
|
||||
public class Lru_cache {
|
||||
private final Hash_adp map = Hash_adp_.New();
|
||||
private Lru_node head, tail;
|
||||
@ -32,7 +32,7 @@ public class Lru_cache {
|
||||
this.max = max;
|
||||
}
|
||||
public Object Get_or_null(Object key) {
|
||||
Lru_node nde = (Lru_node)map.Get_by(key);
|
||||
Lru_node nde = (Lru_node)map.GetByOrNull(key);
|
||||
if (nde == null) {
|
||||
return null;
|
||||
}
|
||||
@ -43,7 +43,7 @@ public class Lru_cache {
|
||||
return nde.Val();
|
||||
}
|
||||
public void Set(Object key, Object val, long size) {
|
||||
Lru_node nde = (Lru_node)map.Get_by(key);
|
||||
Lru_node nde = (Lru_node)map.GetByOrNull(key);
|
||||
if (nde != null) {
|
||||
nde.Val_(val);
|
||||
|
||||
@ -60,7 +60,7 @@ public class Lru_cache {
|
||||
}
|
||||
}
|
||||
public void Del(Object key) {
|
||||
Lru_node nde = (Lru_node)map.Get_by(key);
|
||||
Lru_node nde = (Lru_node)map.GetByOrNull(key);
|
||||
if (nde != null) {
|
||||
Del_node_from_this(nde);
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ 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.core.caches; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.caches; import gplx.*;
|
||||
public class Lru_cache_root {
|
||||
private final Ordered_hash hash = Ordered_hash_.New();
|
||||
public Lru_cache Get_by_key(String key) {return (Lru_cache)hash.Get_by(key);}
|
||||
public Lru_cache Get_by_key(String key) {return (Lru_cache)hash.GetByOrNull(key);}
|
||||
public void Add(Lru_cache grp) {
|
||||
hash.Add(grp.Key(), grp);
|
||||
}
|
||||
|
@ -13,14 +13,14 @@ 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.core.consoles; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.consoles; import gplx.*;
|
||||
public class Console_adp__mem implements Console_adp {
|
||||
private final List_adp written = List_adp_.New();
|
||||
private final Hash_adp ignored = Hash_adp_.New();
|
||||
public boolean Enabled() {return true;}
|
||||
public boolean Canceled_chk() {return false;}
|
||||
public int Chars_per_line_max() {return 80;} public void Chars_per_line_max_(int v) {}
|
||||
public Console_adp__mem Ignore_add(String s) {ignored.Add_as_key_and_val(s); return this;}
|
||||
public Console_adp__mem Ignore_add(String s) {ignored.AddAsKeyAndVal(s); return this;}
|
||||
public void Write_str(String s) {WriteString(s);}
|
||||
public void Write_fmt_w_nl(String s, Object... args) {WriteString(String_.Format(s, args) + String_.CrLf);}
|
||||
public void Write_tmp(String s) {WriteString(s);}
|
||||
@ -39,7 +39,7 @@ public class Console_adp__mem implements Console_adp {
|
||||
|
||||
public List_adp Written() {return written;}
|
||||
public void tst_WrittenStr(String... expd) {
|
||||
String[] actl = new String[written.Count()];
|
||||
String[] actl = new String[written.Len()];
|
||||
int actlLength = Array_.Len(actl);
|
||||
for (int i = 0; i < actlLength; i++)
|
||||
actl[i] = written.Get_at(i).toString();
|
||||
|
@ -13,7 +13,7 @@ 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.core.criterias; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.criterias; import gplx.*;
|
||||
public class Criteria_fld implements Criteria {
|
||||
Criteria_fld(String pre, String key, Criteria crt) {this.pre = pre; this.key = key; this.crt = crt;}
|
||||
public byte Tid() {return Criteria_.Tid_wrapper;}
|
||||
@ -23,7 +23,7 @@ public class Criteria_fld implements Criteria {
|
||||
public String Pre_w_key() {return pre == Pre_null ? key : String_.Concat(pre, ".", key);}
|
||||
public void Val_as_obj_(Object v) {throw Err_.new_unimplemented();}
|
||||
public void Val_from_args(Hash_adp args) {
|
||||
List_adp list = (List_adp)args.Get_by(key); if (list == null) throw Err_.new_wo_type("criteria.fld key not found", "key", key);
|
||||
List_adp list = (List_adp)args.GetByOrNull(key); if (list == null) throw Err_.new_wo_type("criteria.fld key not found", "key", key);
|
||||
Object o = Fill_val(key, crt.Tid(), list);
|
||||
crt.Val_as_obj_(o);
|
||||
}
|
||||
@ -40,7 +40,7 @@ public class Criteria_fld implements Criteria {
|
||||
public static Criteria_fld new_(String pre, String key, Criteria crt) {return new Criteria_fld(pre, key, crt);}
|
||||
public static Criteria_fld new_(String key, Criteria crt) {return new Criteria_fld(Pre_null, key, crt);}
|
||||
public static Object Fill_val(String key, byte tid, List_adp list) {
|
||||
int len = list.Count();
|
||||
int len = list.Len();
|
||||
switch (tid) {
|
||||
case Criteria_.Tid_eq:
|
||||
case Criteria_.Tid_comp:
|
||||
@ -53,7 +53,7 @@ public class Criteria_fld implements Criteria {
|
||||
return new Object[] {list.Get_at(0), list.Get_at(1)};
|
||||
case Criteria_.Tid_in:
|
||||
if (len == 0) throw Err_.new_wo_type("list.len should be > 0", "key", key, "tid", tid, "len", len);
|
||||
return list.To_obj_ary();
|
||||
return list.ToObjAry();
|
||||
case Criteria_.Tid_const:
|
||||
case Criteria_.Tid_not:
|
||||
case Criteria_.Tid_and:
|
||||
|
@ -13,7 +13,7 @@ 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.core.envs; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.envs;
|
||||
import gplx.Bool_;
|
||||
import gplx.Bry_;
|
||||
import gplx.Bry_bfr;
|
||||
@ -33,17 +33,13 @@ import gplx.List_adp_;
|
||||
import gplx.Rls_able;
|
||||
import gplx.String_;
|
||||
import gplx.Tfds;
|
||||
import gplx.Virtual;
|
||||
import gplx.core.threads.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import javax.management.RuntimeErrorException;
|
||||
import gplx.core.brys.fmtrs.*; import gplx.core.strings.*;
|
||||
import gplx.langs.gfs.*;
|
||||
public class Process_adp implements Gfo_invk, Rls_able {
|
||||
public boolean Enabled() {return enabled;} public Process_adp Enabled_(boolean v) {enabled = v; return this;} private boolean enabled = true;
|
||||
public byte Exe_exists() {return exe_exists;} public Process_adp Exe_exists_(byte v) {exe_exists = v; return this;} private byte exe_exists = Bool_.__byte;
|
||||
@ -324,7 +320,7 @@ public class Process_adp implements Gfo_invk, Rls_able {
|
||||
sb.Add(c);
|
||||
}
|
||||
if (sb.Has_some()) list.Add(sb.To_str());
|
||||
return list.To_str_ary();
|
||||
return list.ToStrAry();
|
||||
}
|
||||
}
|
||||
class Thread_ProcessAdp_async extends Thread {
|
||||
|
@ -13,7 +13,7 @@ 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.core.gfo_ndes; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.gfo_ndes; import gplx.*;
|
||||
import gplx.core.strings.*; import gplx.core.type_xtns.*;
|
||||
public class GfoFldList_ {
|
||||
public static final GfoFldList Null = new GfoFldList_null();
|
||||
@ -26,23 +26,23 @@ public class GfoFldList_ {
|
||||
}
|
||||
}
|
||||
class GfoFldList_base implements GfoFldList {
|
||||
public int Count() {return hash.Count();}
|
||||
public int Count() {return hash.Len();}
|
||||
public boolean Has(String key) {return hash.Has(key);}
|
||||
public int Idx_of(String key) {
|
||||
Object rv = idxs.Get_by(key);
|
||||
Object rv = idxs.GetByOrNull(key);
|
||||
return rv == null ? List_adp_.Not_found : Int_.Cast(rv);
|
||||
}
|
||||
public GfoFld Get_at(int i) {return (GfoFld)hash.Get_at(i);}
|
||||
public GfoFld FetchOrNull(String key) {return (GfoFld)hash.Get_by(key);}
|
||||
public GfoFld FetchOrNull(String key) {return (GfoFld)hash.GetByOrNull(key);}
|
||||
public GfoFldList Add(String key, ClassXtn c) {
|
||||
GfoFld fld = GfoFld.new_(key, c);
|
||||
hash.Add(key, fld);
|
||||
idxs.Add(key, idxs.Count());
|
||||
idxs.Add(key, idxs.Len());
|
||||
return this;
|
||||
}
|
||||
public String To_str() {
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
for (int i = 0; i < hash.Count(); i++) {
|
||||
for (int i = 0; i < hash.Len(); i++) {
|
||||
GfoFld fld = this.Get_at(i);
|
||||
sb.Add(fld.Key()).Add("|");
|
||||
}
|
||||
|
@ -13,19 +13,19 @@ 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.core.gfo_ndes; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.gfo_ndes; import gplx.*;
|
||||
import gplx.core.lists.*; /*ComparerAble*/
|
||||
public class GfoNdeList_ {
|
||||
public static final GfoNdeList Null = new GfoNdeList_null();
|
||||
public static GfoNdeList new_() {return new GfoNdeList_base();}
|
||||
}
|
||||
class GfoNdeList_base implements GfoNdeList {
|
||||
public int Count() {return list.Count();}
|
||||
public int Count() {return list.Len();}
|
||||
public GfoNde FetchAt_asGfoNde(int i) {return (GfoNde)list.Get_at(i);}
|
||||
public void Add(GfoNde rcd) {list.Add(rcd);}
|
||||
public void Del(GfoNde rcd) {list.Del(rcd);}
|
||||
public void Clear() {list.Clear();}
|
||||
public void Sort_by(ComparerAble comparer) {list.Sort_by(comparer);}
|
||||
public void Sort_by(ComparerAble comparer) {list.SortBy(comparer);}
|
||||
List_adp list = List_adp_.New();
|
||||
}
|
||||
class GfoNdeList_null implements GfoNdeList {
|
||||
|
@ -13,7 +13,7 @@ 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.core.gfo_ndes; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.gfo_ndes; import gplx.*;
|
||||
import gplx.core.type_xtns.*; import gplx.core.stores.*;
|
||||
public class GfoNde_ {
|
||||
public static final GfoNde[] Ary_empty = new GfoNde[0];
|
||||
@ -37,7 +37,7 @@ public class GfoNde_ {
|
||||
valAry[i] = rdr.ReadAt(i);
|
||||
rows.Add(GfoNde_.vals_(flds, valAry));
|
||||
}
|
||||
return GfoNde_.tbl_("", flds, (GfoNde[])rows.To_ary(GfoNde.class));
|
||||
return GfoNde_.tbl_("", flds, (GfoNde[])rows.ToAry(GfoNde.class));
|
||||
}
|
||||
finally {rdr.Rls();}
|
||||
}
|
||||
|
@ -13,14 +13,14 @@ 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.core.gfo_regys; import gplx.*; import gplx.core.*;
|
||||
import gplx.langs.gfs.*; import gplx.core.type_xtns.*; import gplx.core.interfaces.*;
|
||||
package gplx.core.gfo_regys; import gplx.*;
|
||||
import gplx.core.type_xtns.*; import gplx.core.interfaces.*;
|
||||
public class GfoRegy implements Gfo_invk {
|
||||
public int Count() {return hash.Count();}
|
||||
public int Count() {return hash.Len();}
|
||||
public Hash_adp Parsers() {return parsers;} Hash_adp parsers = Hash_adp_.New();
|
||||
public GfoRegyItm FetchOrNull(String key) {return (GfoRegyItm)hash.Get_by(key);}
|
||||
public GfoRegyItm FetchOrNull(String key) {return (GfoRegyItm)hash.GetByOrNull(key);}
|
||||
public Object FetchValOrFail(String key) {
|
||||
GfoRegyItm rv = (GfoRegyItm)hash.Get_by(key); if (rv == null) throw Err_.new_wo_type("regy does not have key", "key", key);
|
||||
GfoRegyItm rv = (GfoRegyItm)hash.GetByOrNull(key); if (rv == null) throw Err_.new_wo_type("regy does not have key", "key", key);
|
||||
return rv.Val();
|
||||
}
|
||||
public Object FetchValOrNull(String key) {return FetchValOr(key, null);}
|
||||
@ -57,7 +57,7 @@ public class GfoRegy implements Gfo_invk {
|
||||
public void RegObjByType(String key, String val, String type) {
|
||||
Object o = val;
|
||||
if (String_.EqNot(type, StringClassXtn.Key_const)) {
|
||||
ParseAble parser = (ParseAble)parsers.Get_by(type);
|
||||
ParseAble parser = (ParseAble)parsers.GetByOrNull(type);
|
||||
if (parser == null) throw Err_.new_wo_type("could not find parser", "type", type, "key", key, "val", val);
|
||||
o = parser.ParseAsObj(val);
|
||||
}
|
||||
@ -84,7 +84,7 @@ public class GfoRegy implements Gfo_invk {
|
||||
return this;
|
||||
} public static final String Invk_RegDir = "RegDir", Invk_RegObj = "RegObj";
|
||||
void RegItm(String key, Object val, int valType, Io_url url) {
|
||||
hash.Add_if_dupe_use_nth(key, new GfoRegyItm(key, val, valType, url));
|
||||
hash.AddIfDupeUseNth(key, new GfoRegyItm(key, val, valType, url));
|
||||
}
|
||||
Hash_adp hash = Hash_adp_.New();
|
||||
public static final String Err_ChopBgn = "chopBgn results in null key", Err_ChopEnd = "chopEnd results in null key", Err_Dupe = "key already registered";
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
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.core.ios; import gplx.*; import gplx.core.*;
|
||||
/*
|
||||
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.core.ios; import gplx.*;
|
||||
public class IoEngineFxt {
|
||||
IoEngine EngineOf(Io_url url) {return IoEnginePool.Instance.Get_by(url.Info().EngineKey());}
|
||||
public void tst_ExistsPaths(boolean expd, Io_url... ary) {
|
||||
@ -32,14 +32,14 @@ public class IoEngineFxt {
|
||||
public IoEngineFxt tst_QueryFil_modifiedTime(Io_url fil, DateAdp expd) {Tfds.Eq_date(expd, EngineOf(fil).QueryFil(fil).ModifiedTime()); return this;}
|
||||
public IoItmDir tst_ScanDir(Io_url dir, Io_url... expd) {
|
||||
IoItmDir dirItem = EngineOf(dir).QueryDir(dir);
|
||||
Io_url[] actl = new Io_url[dirItem.SubDirs().Count() + dirItem.SubFils().Count()];
|
||||
for (int i = 0; i < dirItem.SubDirs().Count(); i++) {
|
||||
Io_url[] actl = new Io_url[dirItem.SubDirs().Len() + dirItem.SubFils().Len()];
|
||||
for (int i = 0; i < dirItem.SubDirs().Len(); i++) {
|
||||
IoItmDir subDir = IoItmDir_.as_(dirItem.SubDirs().Get_at(i));
|
||||
actl[i] = subDir.Url();
|
||||
}
|
||||
for (int i = 0; i < dirItem.SubFils().Count(); i++) {
|
||||
for (int i = 0; i < dirItem.SubFils().Len(); i++) {
|
||||
IoItmFil subFil = IoItmFil_.as_(dirItem.SubFils().Get_at(i));
|
||||
actl[i + dirItem.SubDirs().Count()] = subFil.Url();
|
||||
actl[i + dirItem.SubDirs().Len()] = subFil.Url();
|
||||
}
|
||||
Tfds.Eq_ary_str(expd, actl);
|
||||
return dirItem;
|
||||
|
@ -13,7 +13,7 @@ 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.core.ios; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.ios; import gplx.*;
|
||||
public class IoEnginePool {
|
||||
private final Hash_adp hash = Hash_adp_.New();
|
||||
public void Add_if_dupe_use_nth(IoEngine engine) {
|
||||
@ -21,7 +21,7 @@ public class IoEnginePool {
|
||||
hash.Add(engine.Key(), engine);
|
||||
}
|
||||
public IoEngine Get_by(String key) {
|
||||
IoEngine rv = (IoEngine)hash.Get_by(key);
|
||||
IoEngine rv = (IoEngine)hash.GetByOrNull(key);
|
||||
return rv == null ? IoEngine_.Mem : rv; // rv == null when url is null or empty; return Mem which should be a noop; DATE:2013-06-04
|
||||
}
|
||||
public static final IoEnginePool Instance = new IoEnginePool();
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
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.core.ios; import gplx.*; import gplx.core.*;
|
||||
/*
|
||||
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.core.ios; import gplx.*;
|
||||
import gplx.core.ios.streams.*; import gplx.core.ios.atrs.*;
|
||||
public class IoEngine_memory extends IoEngine_base {
|
||||
@Override public String Key() {return key;} private String key = IoEngine_.MemKey;
|
||||
@ -21,7 +21,7 @@ public class IoEngine_memory extends IoEngine_base {
|
||||
@Override public void DeleteFil_api(IoEngine_xrg_deleteFil args) {
|
||||
Io_url url = args.Url();
|
||||
IoItmDir dir = FetchDir(url.OwnerDir()); if (dir == null) return; // url doesn't exist; just exit
|
||||
IoItmFil fil = IoItmFil_.as_(dir.SubFils().Get_by(url.NameAndExt()));
|
||||
IoItmFil fil = IoItmFil_.as_(dir.SubFils().GetByOrNull(url.NameAndExt()));
|
||||
if (fil != null && fil.ReadOnly() && args.ReadOnlyFails()) throw IoErr.FileIsReadOnly(url);
|
||||
dir.SubFils().Del(url);
|
||||
}
|
||||
@ -52,7 +52,7 @@ public class IoEngine_memory extends IoEngine_base {
|
||||
Io_url url = args.Url();
|
||||
IoItmDir dir = FetchDir(url.OwnerDir());
|
||||
if (dir != null) {
|
||||
IoItmFil fil = IoItmFil_.as_(dir.SubFils().Get_by(url.NameAndExt()));
|
||||
IoItmFil fil = IoItmFil_.as_(dir.SubFils().GetByOrNull(url.NameAndExt()));
|
||||
if (fil != null && fil.ReadOnly()) throw IoErr.FileIsReadOnly(url);
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ public class IoEngine_memory extends IoEngine_base {
|
||||
IoItmFil_mem FetchFil(Io_url url) {
|
||||
IoItmDir ownerDir = FetchDir(url.OwnerDir());
|
||||
if (ownerDir == null) return IoItmFil_mem.Null;
|
||||
IoItmFil_mem rv = IoItmFil_mem.as_(ownerDir.SubFils().Get_by(url.NameAndExt()));
|
||||
IoItmFil_mem rv = IoItmFil_mem.as_(ownerDir.SubFils().GetByOrNull(url.NameAndExt()));
|
||||
if (rv == null) rv = IoItmFil_mem.Null;
|
||||
return rv;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ 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.core.ios; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.ios; import gplx.*;
|
||||
import gplx.core.strings.*;
|
||||
public class IoEngine_xrg_recycleFil extends IoEngine_xrg_fil_affects1_base {
|
||||
public IoEngine_xrg_recycleFil MissingFails_off() {return MissingFails_(false);} public IoEngine_xrg_recycleFil MissingFails_(boolean v) {MissingFails_set(v); return this;}
|
||||
@ -33,7 +33,7 @@ public class IoEngine_xrg_recycleFil extends IoEngine_xrg_fil_affects1_base {
|
||||
}
|
||||
String ConcatWith_ary(String separator, List_adp ary) {
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
int aryLen = ary.Count();
|
||||
int aryLen = ary.Len();
|
||||
for (int i = 0; i < aryLen; i++) {
|
||||
if (i != 0) sb.Add(separator);
|
||||
Object val = ary.Get_at(i);
|
||||
|
@ -13,7 +13,7 @@ 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.core.ios; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.ios; import gplx.*;
|
||||
import gplx.core.criterias.*;
|
||||
public class IoItmDir extends IoItm_base {
|
||||
public boolean Exists() {return exists;} public void Exists_set(boolean v) {exists = v;} private boolean exists = true;
|
||||
@ -30,7 +30,7 @@ public class IoItmDir extends IoItm_base {
|
||||
Io_url[] XtoIoUrlAry() {
|
||||
IoItmHash list = this.XtoIoItmList(Criteria_.All);
|
||||
//#plat_wce list.Sort(); // NOTE: on wce, subFils retrieved in unexpected order; createTime vs pathString
|
||||
int count = list.Count();
|
||||
int count = list.Len();
|
||||
Io_url[] rv = new Io_url[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
rv[i] = list.Get_at(i).Url();
|
||||
@ -48,7 +48,7 @@ public class IoItmDir extends IoItm_base {
|
||||
int nextDirSprPos = String_.FindFwd(findDirStr, dirSpr); if (nextDirSprPos == String_.Find_none) nextDirSprPos = String_.Len(findDirStr);
|
||||
findName = String_.MidByLen(findDirStr, 0, nextDirSprPos);
|
||||
if (String_.Eq(findDirStr, "")) return curDir; // findDirStr completely removed; all parts match; return curDir
|
||||
curDir = IoItmDir_.as_(curDir.subDirs.Get_by(findName)); // try to find dir
|
||||
curDir = IoItmDir_.as_(curDir.subDirs.GetByOrNull(findName)); // try to find dir
|
||||
if (curDir == null) return null; // dir not found; exit; NOTE: if dir found, loop restarts; with curDir as either findDir, or owner of findDir
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ 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.core.ios; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.ios; import gplx.*;
|
||||
public class IoItmDir_ {
|
||||
public static IoItmDir as_(Object obj) {return obj instanceof IoItmDir ? (IoItmDir)obj : null;}
|
||||
public static final IoItmDir Null = null_();
|
||||
@ -36,12 +36,12 @@ public class IoItmDir_ {
|
||||
}
|
||||
public static void Make(IoItmDir dir) {
|
||||
Io_mgr.Instance.CreateDir(dir.Url());
|
||||
int len = dir.SubDirs().Count();
|
||||
int len = dir.SubDirs().Len();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
IoItmDir sub_dir = (IoItmDir)dir.SubDirs().Get_at(i);
|
||||
Make(sub_dir);
|
||||
}
|
||||
len = dir.SubFils().Count();
|
||||
len = dir.SubFils().Len();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
IoItmFil sub_fil = (IoItmFil)dir.SubFils().Get_at(i);
|
||||
String text = String_.Repeat("a", (int)sub_fil.Size());
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
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.core.ios; import gplx.*; import gplx.core.*;
|
||||
/*
|
||||
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.core.ios; import gplx.*;
|
||||
public class IoItmHash extends Ordered_hash_base {
|
||||
public Io_url Url() {return url;} Io_url url;
|
||||
public void Add(IoItm_base itm) {Add_base(MakeKey(itm.Url()), itm);}
|
||||
@ -21,7 +21,7 @@ public class IoItmHash extends Ordered_hash_base {
|
||||
public IoItm_base Get_by(Io_url url) {return IoItm_base_.as_(Fetch_base(MakeKey(url)));}
|
||||
@gplx.New public IoItm_base Get_at(int i) {return IoItm_base_.as_(Get_at_base(i));}
|
||||
public Io_url[] XtoIoUrlAry() {
|
||||
int count = this.Count();
|
||||
int count = this.Len();
|
||||
Io_url[] rv = new Io_url[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
rv[i] = this.Get_at(i).Url();
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
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.core.ios; import gplx.*; import gplx.core.*;
|
||||
/*
|
||||
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.core.ios; import gplx.*;
|
||||
import gplx.core.lists.*; /*Ordered_hash_base*/
|
||||
public class IoItmList extends Ordered_hash_base {
|
||||
public boolean Has(Io_url url) {return Has_base(MakeKey(url));}
|
||||
@ -28,7 +28,7 @@ public class IoItmList extends Ordered_hash_base {
|
||||
super.Del(key);
|
||||
}
|
||||
public Io_url[] XtoIoUrlAry() {
|
||||
int count = this.Count();
|
||||
int count = this.Len();
|
||||
Io_url[] rv = new Io_url[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
rv[i] = IoItm_base_.as_(i).Url();
|
||||
|
@ -13,8 +13,7 @@ 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.core.ios; import gplx.*; import gplx.core.*;
|
||||
import gplx.langs.gfs.*;
|
||||
package gplx.core.ios; import gplx.*;
|
||||
public abstract class IoItm_base implements Gfo_invk, CompareAble {
|
||||
public abstract int TypeId(); public abstract boolean Type_dir(); public abstract boolean Type_fil();
|
||||
public Io_url Url() {return ownerDir == null ? url : ownerDir.Url().GenSubFil(name); /*NOTE: must call .Url*/} Io_url url;
|
||||
@ -31,7 +30,7 @@ public abstract class IoItm_base implements Gfo_invk, CompareAble {
|
||||
if (ownerDir == null) url = url.OwnerDir().GenSubFil(name);
|
||||
return this;
|
||||
}
|
||||
public Object XtnProps_get(String key) {return props.Get_by(key);} Hash_adp props = Hash_adp_.Noop;
|
||||
public Object XtnProps_get(String key) {return props.GetByOrNull(key);} Hash_adp props = Hash_adp_.Noop;
|
||||
public IoItm_base XtnProps_set(String key, Object val) {
|
||||
if (props == Hash_adp_.Noop) props = Hash_adp_.New();
|
||||
props.Del(key);
|
||||
|
@ -13,7 +13,7 @@ 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.core.ios; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.ios; import gplx.*;
|
||||
import gplx.core.strings.*;
|
||||
public class IoRecycleBin {
|
||||
public void Send(Io_url url) {Send_xrg(url).Exec();}
|
||||
@ -21,7 +21,7 @@ public class IoRecycleBin {
|
||||
public void Recover(Io_url url) {
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
List_adp list = Regy_search(url, sb);
|
||||
int listCount = list.Count(); if (listCount > 1) throw Err_.new_wo_type("found more than 1 url", "count", list.Count());
|
||||
int listCount = list.Len(); if (listCount > 1) throw Err_.new_wo_type("found more than 1 url", "count", list.Len());
|
||||
Io_url trgUrl = (Io_url)list.Get_at(0);
|
||||
IoEngine_xrg_xferFil.move_(url, trgUrl).ReadOnlyFails_(true).Overwrite_(false).Exec();
|
||||
IoEngine_xrg_saveFilStr.new_(FetchRegistryUrl(url), sb.To_str()).Exec();
|
||||
|
@ -13,18 +13,17 @@ 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.core.ios; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.ios; import gplx.*;
|
||||
import gplx.core.envs.*;
|
||||
import gplx.langs.gfs.*;
|
||||
public class IoUrlInfoRegy implements Gfo_invk {
|
||||
public void Reg(IoUrlInfo info) {hash.Add_if_dupe_use_nth(info.Key(), info);}
|
||||
public void Reg(IoUrlInfo info) {hash.AddIfDupeUseNth(info.Key(), info);}
|
||||
public IoUrlInfo Match(String raw) {
|
||||
if (String_.Len(raw) == 0) return IoUrlInfo_.Nil;
|
||||
for (int i = hash.Count(); i > 0; i--) {
|
||||
for (int i = hash.Len(); i > 0; i--) {
|
||||
IoUrlInfo info = (IoUrlInfo)hash.Get_at(i - 1);
|
||||
if (info.Match(raw)) return info;
|
||||
}
|
||||
throw Err_.new_wo_type("could not match ioPathInfo", "raw", raw, "count", hash.Count());
|
||||
throw Err_.new_wo_type("could not match ioPathInfo", "raw", raw, "count", hash.Len());
|
||||
}
|
||||
public void Reset() {
|
||||
hash.Clear();
|
||||
|
@ -25,14 +25,14 @@ import gplx.core.strings.String_bldr;
|
||||
import gplx.core.strings.String_bldr_;
|
||||
public class IoUrlTypeRegy implements Gfo_invk {
|
||||
public String[] FetchAryOr(String key, String... or) {
|
||||
IoUrlTypeGrp itm = (IoUrlTypeGrp)hash.Get_by(key);
|
||||
IoUrlTypeGrp itm = (IoUrlTypeGrp)hash.GetByOrNull(key);
|
||||
return itm == null ? or : itm.AsAry();
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_Get)) {
|
||||
String key = m.ReadStr(k);
|
||||
if (ctx.Deny()) return this;
|
||||
IoUrlTypeGrp itm = (IoUrlTypeGrp)hash.Get_by(key);
|
||||
IoUrlTypeGrp itm = (IoUrlTypeGrp)hash.GetByOrNull(key);
|
||||
if (itm == null) {
|
||||
itm = new IoUrlTypeGrp(key);
|
||||
hash.Add(key, itm);
|
||||
@ -47,8 +47,8 @@ public class IoUrlTypeRegy implements Gfo_invk {
|
||||
}
|
||||
class IoUrlTypeGrp implements Gfo_invk {
|
||||
public String[] AsAry() {
|
||||
String[] rv = new String[list.Count()];
|
||||
for (int i = 0; i < list.Count(); i++)
|
||||
String[] rv = new String[list.Len()];
|
||||
for (int i = 0; i < list.Len(); i++)
|
||||
rv[i] = (String)list.Get_at(i);
|
||||
return rv;
|
||||
}
|
||||
@ -70,7 +70,7 @@ class IoUrlTypeGrp implements Gfo_invk {
|
||||
if (ctx.Deny()) return this;
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
sb.Add(key).Add("{");
|
||||
for (int i = 0; i < list.Count(); i++)
|
||||
for (int i = 0; i < list.Len(); i++)
|
||||
sb.Add_spr_unless_first((String)list.Get_at(i), " ", i);
|
||||
sb.Add("}");
|
||||
return sb.To_str();
|
||||
|
@ -13,10 +13,10 @@ 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.core.ios; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.ios; import gplx.*;
|
||||
public class Io_fil_mkr {
|
||||
private final List_adp list = List_adp_.New();
|
||||
public Io_fil_mkr Add(String url, String data) {return Add(Io_url_.mem_fil_(url), data);}
|
||||
public Io_fil_mkr Add(Io_url url, String data) {list.Add(new Io_fil(url, data)); return this;}
|
||||
public Io_fil[] To_ary() {return (Io_fil[])list.To_ary(Io_fil.class);}
|
||||
public Io_fil[] To_ary() {return (Io_fil[])list.ToAry(Io_fil.class);}
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
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.core.ios.atrs; import gplx.*; import gplx.core.*; import gplx.core.ios.*;
|
||||
/*
|
||||
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.core.ios.atrs; import gplx.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.attribute.AclEntry;
|
||||
@ -55,7 +55,7 @@ class Io_itm_atr_wkr__acl extends Io_itm_atr_wkr { private final AclFileAttribu
|
||||
// * for diff principals, return true if any of them does have permissions
|
||||
case ALLOW: {
|
||||
// if current principal is forbidden, ignore entry; want to skip lists like Everyone:Forbidden:C:/folder;Everyone:Allowed;C:/
|
||||
Bool_obj_val forbidden = (Bool_obj_val)principals.Get_by(itm.Principal());
|
||||
Bool_obj_val forbidden = (Bool_obj_val)principals.GetByOrNull(itm.Principal());
|
||||
if (forbidden != null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1,22 +1,23 @@
|
||||
/*
|
||||
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.core.ios.zips; import gplx.*; import gplx.core.*; import gplx.core.ios.*;
|
||||
/*
|
||||
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.core.ios.zips; import gplx.*;
|
||||
import java.io.*;
|
||||
import java.util.zip.*;
|
||||
import gplx.core.envs.*; import gplx.core.threads.*; import gplx.core.progs.*;
|
||||
import gplx.core.envs.*;
|
||||
import gplx.core.progs.*;
|
||||
class Io_zip_decompress_cmd__jre extends Io_zip_decompress_cmd__base {
|
||||
@Override public Io_zip_decompress_cmd Make_new() {return new Io_zip_decompress_cmd__jre();}
|
||||
@Override protected byte Exec_hook(gplx.core.progs.Gfo_prog_ui prog_ui, Io_url src_fil, Io_url trg_dir, List_adp trg_fils, String resume_name, long resume_file, long resume_item) {
|
||||
@ -90,7 +91,7 @@ class Io_zip_decompress_cmd__jre extends Io_zip_decompress_cmd__base {
|
||||
Io_mgr.Instance.CreateDir(trg_fil_url);
|
||||
}
|
||||
}
|
||||
Gfo_evt_mgr_.Pub_val(Io_mgr.Instance, Io_mgr.Evt__fil_created, trg_fils.To_ary(Io_url.class));
|
||||
Gfo_evt_mgr_.Pub_val(Io_mgr.Instance, Io_mgr.Evt__fil_created, trg_fils.ToAry(Io_url.class));
|
||||
}
|
||||
catch(IOException e) {throw Err_.new_exc(e, "ios.zip", "error duing unzip", "src", src_fil.Raw(), "trg", trg_dir.Raw());}
|
||||
finally {
|
||||
|
@ -13,24 +13,25 @@ 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.core.lists; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.lists; import gplx.Err_;
|
||||
import gplx.Hash_adp;
|
||||
public abstract class Hash_adp_base implements Hash_adp {
|
||||
public boolean Has(Object key) {return Has_base(key);}
|
||||
public Object Get_by(Object key) {return Fetch_base(key);}
|
||||
public Object Get_by_or_fail(Object key) {return Get_by_or_fail_base(key);}
|
||||
public Object GetByOrNull(Object key) {return Fetch_base(key);}
|
||||
public Object GetByOrFail(Object key) {return Get_by_or_fail_base(key);}
|
||||
public void Add(Object key, Object val) {Add_base(key, val);}
|
||||
public Hash_adp Add_and_more(Object key, Object val) {Add_base(key, val); return this;}
|
||||
public Hash_adp Add_many_as_key_and_val(Object... ary) {
|
||||
public Hash_adp AddAndMore(Object key, Object val) {Add_base(key, val); return this;}
|
||||
public Hash_adp AddManyAsKeyAndVal(Object... ary) {
|
||||
for (Object itm : ary)
|
||||
Add_base(itm, itm);
|
||||
return this;
|
||||
}
|
||||
public void Add_as_key_and_val(Object val) {Add_base(val, val);}
|
||||
public void Add_if_dupe_use_nth(Object key, Object val) {
|
||||
public void AddAsKeyAndVal(Object val) {Add_base(val, val);}
|
||||
public void AddIfDupeUseNth(Object key, Object val) {
|
||||
Object existing = Fetch_base(key); if (existing != null) Del(key); // overwrite if exists
|
||||
Add(key, val);
|
||||
}
|
||||
public boolean Add_if_dupe_use_1st(Object key, Object val) {
|
||||
public boolean AddIfDupeUse1st(Object key, Object val) {
|
||||
if (Has(key)) return false;
|
||||
Add(key, val);
|
||||
return true;
|
||||
@ -45,7 +46,6 @@ public abstract class Hash_adp_base implements Hash_adp {
|
||||
// private final java.util.HashMap<Object, Object> hash = new java.util.HashMap<Object, Object>();
|
||||
private final java.util.Hashtable hash = new java.util.Hashtable();
|
||||
public int Len() {return hash.size();}
|
||||
public int Count() {return hash.size();}
|
||||
public void Clear() {hash.clear();}
|
||||
protected void Add_base(Object key, Object val) {hash.put(key, val);}
|
||||
protected void Del_base(Object key) {hash.remove(key);}
|
||||
|
@ -1,23 +1,23 @@
|
||||
/*
|
||||
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.core.lists; import gplx.*; import gplx.core.*;
|
||||
/*
|
||||
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.core.lists; import gplx.*;
|
||||
public class Hash_adp_list extends Hash_adp_base {
|
||||
@gplx.New public List_adp Get_by(Object key) {return ((List_adp)Fetch_base(key));}
|
||||
@gplx.New public List_adp GetByOrNull(Object key) {return ((List_adp)Fetch_base(key));}
|
||||
public List_adp Get_by_or_new(Object key) {
|
||||
List_adp rv = Get_by(key);
|
||||
List_adp rv = GetByOrNull(key);
|
||||
if (rv == null) {
|
||||
rv = List_adp_.New();
|
||||
Add_base(key, rv);
|
||||
@ -29,10 +29,10 @@ public class Hash_adp_list extends Hash_adp_base {
|
||||
list.Add(val);
|
||||
}
|
||||
public void DelInList(Object key, Object val) {
|
||||
List_adp list = Get_by(key);
|
||||
List_adp list = GetByOrNull(key);
|
||||
if (list == null) return;
|
||||
list.Del(val);
|
||||
if (list.Count() == 0) Del(key);
|
||||
if (list.Len() == 0) Del(key);
|
||||
}
|
||||
public static Hash_adp_list new_() {return new Hash_adp_list();} Hash_adp_list() {}
|
||||
}
|
||||
|
@ -13,8 +13,7 @@ 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.core.lists; import gplx.*; import gplx.core.*;
|
||||
public interface List_adp__getable {
|
||||
int Len();
|
||||
Object Get_at(int i);
|
||||
}
|
||||
package gplx.core.lists;
|
||||
public interface List_adp__getable {
|
||||
Object Get_at(int i);
|
||||
}
|
||||
|
@ -13,26 +13,27 @@ 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.core.lists; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.lists; import gplx.Err_;
|
||||
import gplx.Hash_adp;
|
||||
public class Sorted_hash implements Hash_adp {
|
||||
public Sorted_hash() {this.hash = new java.util.TreeMap();}
|
||||
public Sorted_hash(ComparerAble comparer) {this.hash = new java.util.TreeMap(comparer);}
|
||||
public boolean Has(Object key) {return Has_base(key);}
|
||||
public Object Get_by(Object key) {return Fetch_base(key);}
|
||||
public Object Get_by_or_fail(Object key) {return Get_by_or_fail_base(key);}
|
||||
public Object GetByOrNull(Object key) {return Fetch_base(key);}
|
||||
public Object GetByOrFail(Object key) {return Get_by_or_fail_base(key);}
|
||||
public void Add(Object key, Object val) {Add_base(key, val);}
|
||||
public Hash_adp Add_and_more(Object key, Object val) {Add_base(key, val); return this;}
|
||||
public Hash_adp Add_many_as_key_and_val(Object... ary) {
|
||||
public Hash_adp AddAndMore(Object key, Object val) {Add_base(key, val); return this;}
|
||||
public Hash_adp AddManyAsKeyAndVal(Object... ary) {
|
||||
for (Object itm : ary)
|
||||
Add_base(itm, itm);
|
||||
return this;
|
||||
}
|
||||
public void Add_as_key_and_val(Object val) {Add_base(val, val);}
|
||||
public void Add_if_dupe_use_nth(Object key, Object val) {
|
||||
public void AddAsKeyAndVal(Object val) {Add_base(val, val);}
|
||||
public void AddIfDupeUseNth(Object key, Object val) {
|
||||
Object existing = Fetch_base(key); if (existing != null) Del(key); // overwrite if exists
|
||||
Add(key, val);
|
||||
}
|
||||
public boolean Add_if_dupe_use_1st(Object key, Object val) {
|
||||
public boolean AddIfDupeUse1st(Object key, Object val) {
|
||||
if (Has(key)) return false;
|
||||
Add(key, val);
|
||||
return true;
|
||||
@ -51,8 +52,7 @@ public class Sorted_hash implements Hash_adp {
|
||||
}
|
||||
|
||||
private final java.util.TreeMap hash;
|
||||
public int Len() {return hash.size();}
|
||||
public int Count() {return hash.size();}
|
||||
public int Len() {return hash.size();}
|
||||
public void Clear() {hash.clear();}
|
||||
private void Add_base(Object key, Object val) {hash.put(key, val);}
|
||||
private void Del_base(Object key) {hash.remove(key);}
|
||||
|
@ -13,7 +13,7 @@ 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.core.lists; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.lists; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class StackAdp_tst {
|
||||
@Test public void XtoList() {
|
||||
@ -24,7 +24,7 @@ public class StackAdp_tst {
|
||||
for (int i : ary)
|
||||
stack.Push(i);
|
||||
List_adp list = stack.XtoList();
|
||||
int[] actl = (int[])list.To_ary(int.class);
|
||||
int[] actl = (int[])list.ToAry(int.class);
|
||||
for (int i = 0; i < ary.length; i++)
|
||||
Tfds.Eq(ary[i], actl[i]);
|
||||
}
|
||||
|
@ -13,18 +13,18 @@ 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.core.lists.hashs; import gplx.*; import gplx.core.*; import gplx.core.lists.*;
|
||||
package gplx.core.lists.hashs; import gplx.*;
|
||||
import gplx.core.primitives.*;
|
||||
public class Hash_adp__int {
|
||||
private final Hash_adp hash = Hash_adp_.New();
|
||||
private final Int_obj_ref tmp_key = Int_obj_ref.New_neg1();
|
||||
public void Clear() {hash.Clear();}
|
||||
public int Len() {return hash.Count();}
|
||||
public Object Get_by_or_fail(int key) {synchronized (tmp_key) {return hash.Get_by_or_fail(tmp_key.Val_(key));}} // LOCK:used by Xomp_ns_ord_mgr in xomp; DATE:2016-10-18
|
||||
public Object Get_by_or_null(int key) {synchronized (tmp_key) {return hash.Get_by(tmp_key.Val_(key));}} // LOCK:used by Xomp_ns_ord_mgr in xomp; DATE:2016-10-18
|
||||
public int Len() {return hash.Len();}
|
||||
public Object Get_by_or_fail(int key) {synchronized (tmp_key) {return hash.GetByOrFail(tmp_key.Val_(key));}} // LOCK:used by Xomp_ns_ord_mgr in xomp; DATE:2016-10-18
|
||||
public Object Get_by_or_null(int key) {synchronized (tmp_key) {return hash.GetByOrNull(tmp_key.Val_(key));}} // LOCK:used by Xomp_ns_ord_mgr in xomp; DATE:2016-10-18
|
||||
public void Add(int key, Object obj) {hash.Add(Int_obj_ref.New(key), obj);}
|
||||
public void Add(Int_obj_ref key, Object obj) {hash.Add(key, obj);}
|
||||
public void Add_if_dupe_use_1st(int key, Object obj) {hash.Add_if_dupe_use_1st(Int_obj_ref.New(key), obj);}
|
||||
public void Add_if_dupe_use_nth(Int_obj_ref key, Object obj) {hash.Add_if_dupe_use_nth(key, obj);}
|
||||
public void Add_if_dupe_use_1st(int key, Object obj) {hash.AddIfDupeUse1st(Int_obj_ref.New(key), obj);}
|
||||
public void Add_if_dupe_use_nth(Int_obj_ref key, Object obj) {hash.AddIfDupeUseNth(key, obj);}
|
||||
public Hash_adp__int Add_as_bry(int key, String val) {hash.Add(Int_obj_ref.New(key), Bry_.new_u8(val)); return this;}
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
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.core.log_msgs; import gplx.*; import gplx.core.*;
|
||||
/*
|
||||
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.core.log_msgs; import gplx.*;
|
||||
public class Gfo_msg_grp implements Gfo_msg_obj {
|
||||
public Gfo_msg_grp(Gfo_msg_grp owner, int uid, byte[] key) {
|
||||
this.owner = owner; this.uid = uid; this.key = key; this.key_str = String_.new_a7(key);
|
||||
@ -32,7 +32,7 @@ public class Gfo_msg_grp implements Gfo_msg_obj {
|
||||
public byte[] Path() {return path;} private byte[] path;
|
||||
public String Path_str() {return String_.new_a7(path);}
|
||||
public Gfo_msg_obj Subs_get_by_key(String sub_key) {
|
||||
int subs_len = subs.Count();
|
||||
int subs_len = subs.Len();
|
||||
for (int i = 0; i < subs_len; i++) {
|
||||
Gfo_msg_obj sub = (Gfo_msg_obj)subs.Get_at(i);
|
||||
if (String_.Eq(sub_key, sub.Key_str())) return sub;
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
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.core.log_msgs; import gplx.*; import gplx.core.*;
|
||||
/*
|
||||
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.core.log_msgs; import gplx.*;
|
||||
public class Gfo_msg_root {
|
||||
public Gfo_msg_root(String root_key) {
|
||||
this.root_key = root_key;
|
||||
@ -40,7 +40,7 @@ public class Gfo_msg_root {
|
||||
public Gfo_msg_data Data_new_note_many(String owner_key, String key, String fmt, Object... vals) {return Data_new_many(Gfo_msg_itm_.Cmd_note, Bry_.Empty, -1, -1, owner_key, key, fmt, vals);}
|
||||
public Gfo_msg_data Data_new_many(byte cmd, String owner_key, String key, String fmt, Object[] vals) {return Data_new_many(cmd, Bry_.Empty, -1, -1, owner_key, key, fmt, vals);}
|
||||
public Gfo_msg_data Data_new_many(byte cmd, byte[] src, int bgn, int end, String owner_key, String key, String fmt, Object[] vals) {
|
||||
Object owner_obj = owners.Get_by(owner_key);
|
||||
Object owner_obj = owners.GetByOrNull(owner_key);
|
||||
Gfo_msg_grp owner = null;
|
||||
if (owner_obj == null) {
|
||||
owner = New_list_by_key(owner_key);
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
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.core.primitives; import gplx.*; import gplx.core.*;
|
||||
/*
|
||||
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.core.primitives; import gplx.*;
|
||||
import gplx.core.strings.*;
|
||||
public class EnmMgr {
|
||||
public String BitRngSpr() {return bitRngSpr;} public EnmMgr BitRngSpr_(String val) {bitRngSpr = val; return this;} private String bitRngSpr = "+";
|
||||
@ -25,7 +25,7 @@ public class EnmMgr {
|
||||
valRegy.Add(val, raw);
|
||||
objRegy.Add(val, o);
|
||||
}
|
||||
public Object Get(int val) {return objRegy.Get_by(val);}
|
||||
public Object Get(int val) {return objRegy.GetByOrNull(val);}
|
||||
public int GetVal(String raw) {
|
||||
String[] ary = String_.Split(raw, bitRngSpr);
|
||||
int rv = 0;
|
||||
@ -36,7 +36,7 @@ public class EnmMgr {
|
||||
if (String_.Has_at_bgn(term, "#"))
|
||||
cur = Int_.Parse(String_.Mid(term, 1));
|
||||
else
|
||||
cur = Int_.Cast(rawRegy.Get_by(term));
|
||||
cur = Int_.Cast(rawRegy.GetByOrNull(term));
|
||||
rv |= cur;
|
||||
}
|
||||
return rv;
|
||||
@ -60,7 +60,7 @@ public class EnmMgr {
|
||||
return sb.To_str();
|
||||
}
|
||||
void AppendRaw(String_bldr sb, int key) {
|
||||
String raw = (String)valRegy.Get_by(key);
|
||||
String raw = (String)valRegy.GetByOrNull(key);
|
||||
if (sb.Count() > 0) sb.Add(bitRngSpr);
|
||||
if (prefix != null) sb.Add(prefix);
|
||||
sb.Add(raw);
|
||||
|
@ -13,7 +13,7 @@ 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.core.security.algos; import gplx.*; import gplx.core.*; import gplx.core.security.*;
|
||||
package gplx.core.security.algos; import gplx.*;
|
||||
public class Hash_algo_factory__composite implements Hash_algo_factory {
|
||||
private boolean dirty = true;
|
||||
private final Ordered_hash hash = Ordered_hash_.New();
|
||||
@ -30,7 +30,7 @@ public class Hash_algo_factory__composite implements Hash_algo_factory {
|
||||
return algo_keys;
|
||||
}
|
||||
public Hash_algo New_hash_algo(String key) {
|
||||
Hash_algo rv = (Hash_algo)hash.Get_by(key);
|
||||
Hash_algo rv = (Hash_algo)hash.GetByOrNull(key);
|
||||
if (rv == null) {
|
||||
throw Err_.new_wo_type("hash_algo unknown; key=" + key);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ 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.core.security.algos.gplx_crypto; import gplx.*; import gplx.core.*; import gplx.core.security.*; import gplx.core.security.algos.*;
|
||||
package gplx.core.security.algos.gplx_crypto; import gplx.*;
|
||||
import org.junit.*; import gplx.core.consoles.*; import gplx.core.ios.streams.*; /*IoStream*/
|
||||
public class Hash_console_wtr_tst {
|
||||
private final Hash_console_wtr_fxt fxt = new Hash_console_wtr_fxt();
|
||||
@ -39,7 +39,7 @@ class Hash_console_wtr_fxt {
|
||||
algo.Calc_hash_w_prog_as_str(stream, console);
|
||||
|
||||
// test
|
||||
String[] actl = console.Written().To_str_ary();
|
||||
String[] actl = console.Written().ToStrAry();
|
||||
Tfds.Eq_ary(actl, expd);
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,8 @@ 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.core.stores.xmls; import gplx.*; import gplx.core.*; import gplx.core.stores.*;
|
||||
package gplx.core.stores.xmls; import gplx.*;
|
||||
import gplx.core.stores.*;
|
||||
import gplx.core.strings.*; import gplx.core.gfo_ndes.*;
|
||||
public class XmlDataWtr_ {
|
||||
public static DataWtr new_() {return XmlDataWtr.new_();}
|
||||
@ -44,7 +45,7 @@ class XmlDataWtr extends DataWtr_base implements DataWtr {
|
||||
@Override public void WriteNodeBgn(String nodeName) {this.WriteXmlNodeBegin(nodeName);}
|
||||
@Override public void WriteNodeEnd() {this.WriteXmlNodeEnd();}
|
||||
public String To_str() {
|
||||
while (names.Count() > 0) {
|
||||
while (names.Len() > 0) {
|
||||
WriteXmlNodeEnd();
|
||||
}
|
||||
return sb.To_str();
|
||||
@ -83,10 +84,10 @@ class XmlDataWtr extends DataWtr_base implements DataWtr {
|
||||
ndeOpened = false;
|
||||
}
|
||||
else {
|
||||
String name = (String)names.Get_at_last();
|
||||
String name = (String)names.GetAtLast();
|
||||
sb.Add("</" + name + ">" + String_.CrLf);
|
||||
}
|
||||
names.Del_at(names.Count() - 1);
|
||||
names.DelAt(names.Len() - 1);
|
||||
// if (nde.ParentNode == null) throw Err_.new_wo_type("WriteXmlNodeEnd() called on root node");
|
||||
// nde = nde.ParentNode;
|
||||
// WriteLineFeed(doc, nde);
|
||||
|
@ -13,7 +13,7 @@ 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.core.tests; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.tests; import gplx.*;
|
||||
public class Gfo_test_err_mgr {
|
||||
private final List_adp expd = List_adp_.New();
|
||||
public void Init() {
|
||||
@ -33,10 +33,10 @@ public class Gfo_test_err_mgr {
|
||||
int actl_len = actl.Len();
|
||||
if (expd_len == 0 && actl_len == 0) {}
|
||||
else if (actl_len == 0) {
|
||||
Gftest.Fail("expected some errors; got zero; expd={0}", expd.To_str());
|
||||
Gftest.Fail("expected some errors; got zero; expd={0}", expd.ToStr());
|
||||
}
|
||||
else if (expd_len == 0) {
|
||||
Gftest.Fail("expected zero errors; got some; actl={0}", actl.To_str());
|
||||
Gftest.Fail("expected zero errors; got some; actl={0}", actl.ToStr());
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < actl_len; i++) {
|
||||
|
@ -13,7 +13,7 @@ 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.core.tests; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.tests; import gplx.*;
|
||||
import gplx.core.strings.*;
|
||||
public class Gfo_test_itm {
|
||||
private final boolean is_expd;
|
||||
@ -23,7 +23,7 @@ public class Gfo_test_itm {
|
||||
}
|
||||
public int Len() {return hash.Len();}
|
||||
public Gfo_test_itm Add(String key, Object val) {hash.Add(key, Keyval_.new_(key, val)); return this;}
|
||||
private Object Get_by_val(String key) {return ((Keyval)hash.Get_by_or_fail(key)).Val();}
|
||||
private Object Get_by_val(String key) {return ((Keyval)hash.GetByOrFail(key)).Val();}
|
||||
public String Get_str(String key) {
|
||||
Object val_obj = Get_by_val(key);
|
||||
if (Type_.Eq_by_obj(val_obj, byte[].class)) {
|
||||
@ -77,7 +77,7 @@ public class Gfo_test_itm {
|
||||
String key = expd_kv.Key();
|
||||
expd_ary[i] = Object_.Xto_str_strict_or_null(expd_kv.Val());
|
||||
|
||||
Keyval actl_kv = (Keyval)actl.hash.Get_by(key);
|
||||
Keyval actl_kv = (Keyval)actl.hash.GetByOrNull(key);
|
||||
actl_ary[i] = actl_kv == null ? "MISSING" : Object_.Xto_str_strict_or_null(actl_kv.Val());
|
||||
}
|
||||
Gftest.Eq__ary(expd_ary, actl_ary);
|
||||
|
@ -13,7 +13,7 @@ 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.core.tests; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.tests; import gplx.*;
|
||||
import gplx.core.strings.*;
|
||||
public class Gfo_test_lnr_base {
|
||||
private String[] keys;
|
||||
@ -37,10 +37,10 @@ public class Gfo_test_lnr_base {
|
||||
int actl_len = actl_list.Len();
|
||||
if (expd_len == 0 && actl_len == 0) {}
|
||||
else if (actl_len == 0) {
|
||||
Gftest.Fail("expected some itms; got zero; expd={0}", expd_list.To_str());
|
||||
Gftest.Fail("expected some itms; got zero; expd={0}", expd_list.ToStr());
|
||||
}
|
||||
else if (expd_len == 0) {
|
||||
Gftest.Fail("expected zero itms; got some; actl={0}", actl_list.To_str());
|
||||
Gftest.Fail("expected zero itms; got some; actl={0}", actl_list.ToStr());
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < actl_len; i++) {
|
||||
|
@ -13,12 +13,12 @@ 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.core.tests; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.tests; import gplx.*;
|
||||
import gplx.core.strings.*; import gplx.core.envs.*;
|
||||
public class PerfLogMgr_fxt {
|
||||
public void Init(Io_url url, String text) {
|
||||
this.url = url;
|
||||
entries.Resize_bounds(1000);
|
||||
entries.ResizeBounds(1000);
|
||||
entries.Add(new PerfLogItm(0, text + "|" + Datetime_now.Get().XtoStr_gplx()));
|
||||
tmr.Bgn();
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
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.core.texts; import gplx.*; import gplx.core.*;
|
||||
/*
|
||||
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.core.texts; import gplx.*;
|
||||
import gplx.core.strings.*;
|
||||
public class StringTableBldr {
|
||||
public void ClearRows() {rows.Clear();}
|
||||
@ -28,7 +28,7 @@ public class StringTableBldr {
|
||||
return this;
|
||||
}
|
||||
public StringTableCol FetchAtOrNew(int i) {
|
||||
if (i < cols.Count()) return StringTableCol.as_(cols.Get_at(i));
|
||||
if (i < cols.Len()) return StringTableCol.as_(cols.Get_at(i));
|
||||
StringTableCol col = StringTableCol.new_();
|
||||
col.Halign_(defaultHalign);
|
||||
cols.Add(i, col);
|
||||
@ -36,11 +36,11 @@ public class StringTableBldr {
|
||||
}
|
||||
public String To_str() {
|
||||
sb.Clear();
|
||||
for (int rowI = 0; rowI < rows.Count(); rowI++) {
|
||||
for (int rowI = 0; rowI < rows.Len(); rowI++) {
|
||||
String[] row = (String[])rows.Get_at(rowI);
|
||||
for (int colI = 0; colI < row.length; colI++) {
|
||||
if (colI != 0) sb.Add(" ");
|
||||
StringTableCol col = StringTableCol.as_(cols.Get_at(colI)); if (col == null) throw Err_.new_missing_idx(colI, cols.Count());
|
||||
StringTableCol col = StringTableCol.as_(cols.Get_at(colI)); if (col == null) throw Err_.new_missing_idx(colI, cols.Len());
|
||||
sb.Add(col.PadCell(row[colI]));
|
||||
}
|
||||
sb.Add(String_.CrLf);
|
||||
|
@ -13,7 +13,7 @@ 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.core.threads; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.threads; import gplx.*;
|
||||
public class Thread_adp_mgr {
|
||||
private final Ordered_hash hash = Ordered_hash_.New();
|
||||
private final int sleep_time, quit_time;
|
||||
@ -21,7 +21,7 @@ public class Thread_adp_mgr {
|
||||
public void Add(String key, Thread_adp thread) {
|
||||
Thread_halt_itm itm = null;
|
||||
synchronized (hash) {
|
||||
itm = (Thread_halt_itm)hash.Get_by(key);
|
||||
itm = (Thread_halt_itm)hash.GetByOrNull(key);
|
||||
if (itm != null && !itm.Thread.Thread__is_alive())
|
||||
hash.Del(key);
|
||||
}
|
||||
@ -29,7 +29,7 @@ public class Thread_adp_mgr {
|
||||
hash.Add(key, itm);
|
||||
}
|
||||
public void Halt(String uid, Thread_halt_cbk cbk) {
|
||||
Thread_halt_itm itm = (Thread_halt_itm)hash.Get_by(uid);
|
||||
Thread_halt_itm itm = (Thread_halt_itm)hash.GetByOrNull(uid);
|
||||
Halt_by_wkr(itm, cbk);
|
||||
}
|
||||
public void Halt_all(Thread_halt_cbk cbk) {
|
||||
|
@ -13,7 +13,7 @@ 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.langs.dsvs; import gplx.*; import gplx.langs.*;
|
||||
package gplx.langs.dsvs; import gplx.*;
|
||||
import gplx.core.strings.*; import gplx.core.gfo_ndes.*; import gplx.core.stores.*; import gplx.core.type_xtns.*;
|
||||
import gplx.core.texts.*; /*CharStream*/
|
||||
public class DsvDataRdr_ {
|
||||
@ -104,7 +104,7 @@ class DsvParser {
|
||||
throw Err_.new_wo_type("unable to process field value", "value", val);
|
||||
}
|
||||
void ProcessLine(CharStream strm, boolean cleanup) {
|
||||
if (sb.Count() == 0 && tkns.Count() == 0)
|
||||
if (sb.Count() == 0 && tkns.Len() == 0)
|
||||
if (csvOn) { // csvOn b/c csvMode allows blank lines as empty data
|
||||
if (cleanup) // cleanup b/c blankLine should not be added when called by cleanup, else will always add extra row at end
|
||||
return; // cleanup, so no further action needed; return;
|
||||
@ -186,7 +186,7 @@ class DsvTblBldr {
|
||||
tkns.Clear();
|
||||
else { // comments in HDR
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
for (int i = 0; i < tkns.Count(); i++)
|
||||
for (int i = 0; i < tkns.Len(); i++)
|
||||
sb.Add((String)tkns.Get_at(i));
|
||||
layout.HeaderList().Add_Comment(sb.To_str());
|
||||
tkns.Clear();
|
||||
@ -198,18 +198,18 @@ class DsvTblBldr {
|
||||
stage = Stage_Init; // NOTE: mark stage as INIT;
|
||||
}
|
||||
public void MakeVals(List_adp tkns) {
|
||||
if (stage != Stage_Row) CreateFlds(tkns.Count()); // stage != Stage_Row means if (noRowsCreated)
|
||||
if (stage != Stage_Row) CreateFlds(tkns.Len()); // stage != Stage_Row means if (noRowsCreated)
|
||||
GfoNde row = GfoNde_.vals_(tbl.SubFlds(), MakeValsAry(tkns));
|
||||
tbl.Subs().Add(row);
|
||||
stage = Stage_Row; tkns.Clear();
|
||||
}
|
||||
Object[] MakeValsAry(List_adp tkns) {
|
||||
GfoFldList subFlds = tbl.SubFlds(); int subFldsCount = subFlds.Count();
|
||||
if (tkns.Count() > subFldsCount) throw Err_.new_wo_type("values.Count cannot be greater than fields.Count", "values.Count", tkns.Count(), "fields.Count", subFldsCount);
|
||||
if (tkns.Len() > subFldsCount) throw Err_.new_wo_type("values.Count cannot be greater than fields.Count", "values.Count", tkns.Len(), "fields.Count", subFldsCount);
|
||||
Object[] rv = new Object[subFldsCount];
|
||||
for (int i = 0; i < subFldsCount; i++) {
|
||||
ClassXtn typx = subFlds.Get_at(i).Type();
|
||||
String val = i < tkns.Count() ? (String)tkns.Get_at(i) : null;
|
||||
String val = i < tkns.Len() ? (String)tkns.Get_at(i) : null;
|
||||
rv[i] = typx.ParseOrNull(val);
|
||||
}
|
||||
return rv;
|
||||
@ -223,7 +223,7 @@ class DsvTblBldr {
|
||||
stage = Stage_Hdr;
|
||||
}
|
||||
void CreateFlds(int valCount) {
|
||||
int fldNamesCount = fldNames.Count(), fldTypesCount = fldTypes.Count();
|
||||
int fldNamesCount = fldNames.Len(), fldTypesCount = fldTypes.Len();
|
||||
if (fldNamesCount == 0 && fldTypesCount == 0) { // csv tbls where no names or types, just values
|
||||
for (int i = 0; i < valCount; i++)
|
||||
tbl.SubFlds().Add("fld" + i, StringClassXtn.Instance);
|
||||
|
@ -13,7 +13,7 @@ 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.langs.dsvs; import gplx.*; import gplx.langs.*;
|
||||
package gplx.langs.dsvs; import gplx.*;
|
||||
import org.junit.*; import gplx.core.strings.*; import gplx.core.gfo_ndes.*;
|
||||
public class DsvDataRdr_csv_dat_tst {
|
||||
@Before public void setup() {
|
||||
@ -171,7 +171,7 @@ class DsvDataRdr_fxt {
|
||||
GfoNde tbl = root.Subs().FetchAt_asGfoNde(i);
|
||||
actlList.Add(tbl.Name());
|
||||
}
|
||||
Tfds.Eq_ary(expdNames, actlList.To_str_ary());
|
||||
Tfds.Eq_ary(expdNames, actlList.ToStrAry());
|
||||
return this;
|
||||
}
|
||||
public DsvDataRdr_fxt tst_DatNull() {
|
||||
|
@ -13,7 +13,7 @@ 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.langs.dsvs; import gplx.*; import gplx.langs.*;
|
||||
package gplx.langs.dsvs; import gplx.*;
|
||||
import org.junit.*; import gplx.core.gfo_ndes.*; import gplx.core.type_xtns.*;
|
||||
public class DsvDataRdr_layout_tst {
|
||||
@Test public void TableName() {
|
||||
@ -119,7 +119,7 @@ public class DsvDataRdr_layout_tst {
|
||||
}
|
||||
void tst_Layout(int subIdx, int... expd) {
|
||||
GfoNde tbl = root.Subs().FetchAt_asGfoNde(subIdx);
|
||||
DsvStoreLayout layout = (DsvStoreLayout)tbl.EnvVars().Get_by(DsvStoreLayout.Key_const);
|
||||
DsvStoreLayout layout = (DsvStoreLayout)tbl.EnvVars().GetByOrNull(DsvStoreLayout.Key_const);
|
||||
int[] actl = new int[layout.HeaderList().Count()];
|
||||
for (int i = 0; i < actl.length; i++)
|
||||
actl[i] = layout.HeaderList().Get_at(i).Id();
|
||||
|
@ -13,9 +13,9 @@ 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.langs.dsvs; import gplx.*; import gplx.langs.*;
|
||||
package gplx.langs.dsvs; import gplx.*;
|
||||
public class DsvHeaderList {
|
||||
@gplx.Internal protected int Count() {return list.Count();}
|
||||
@gplx.Internal protected int Count() {return list.Len();}
|
||||
@gplx.Internal protected DsvHeaderItm Get_at(int i) {return (DsvHeaderItm)list.Get_at(i);}
|
||||
public DsvHeaderList Add_LeafTypes() {this.Add(new DsvHeaderItm(DsvHeaderItm.Id_LeafTypes, null)); return this;}
|
||||
public DsvHeaderList Add_LeafNames() {this.Add(new DsvHeaderItm(DsvHeaderItm.Id_LeafNames, null)); return this;}
|
||||
|
@ -1,28 +1,28 @@
|
||||
/*
|
||||
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.langs.gfs; import gplx.*; import gplx.langs.*;
|
||||
class GfsRegy implements Gfo_invk {
|
||||
public int Count() {return hash.Count();}
|
||||
/*
|
||||
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.langs.gfs; import gplx.*;
|
||||
class GfsRegy implements Gfo_invk {
|
||||
public int Count() {return hash.Len();}
|
||||
public void Clear() {hash.Clear(); typeHash.Clear();}
|
||||
public boolean Has(String k) {return hash.Has(k);}
|
||||
public GfsRegyItm Get_at(int i) {return (GfsRegyItm)hash.Get_at(i);}
|
||||
public GfsRegyItm Get_by(String key) {return (GfsRegyItm)hash.Get_by(key);}
|
||||
public GfsRegyItm FetchByType(Gfo_invk invk) {return (GfsRegyItm)typeHash.Get_by(Type_.Canonical_name_by_obj(invk));}
|
||||
public GfsRegyItm Get_by(String key) {return (GfsRegyItm)hash.GetByOrNull(key);}
|
||||
public GfsRegyItm FetchByType(Gfo_invk invk) {return (GfsRegyItm)typeHash.GetByOrNull(Type_.Canonical_name_by_obj(invk));}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
Object rv = (GfsRegyItm)hash.Get_by(k); if (rv == null) throw Err_.new_missing_key(k);
|
||||
Object rv = (GfsRegyItm)hash.GetByOrNull(k); if (rv == null) throw Err_.new_missing_key(k);
|
||||
return rv;
|
||||
}
|
||||
public void AddObj(Gfo_invk invk, String key) {Add(key, invk, false);}
|
||||
@ -31,10 +31,10 @@ class GfsRegy implements Gfo_invk {
|
||||
if (hash.Has(key)) return;
|
||||
GfsRegyItm regyItm = new GfsRegyItm().Key_(key).InvkAble_(invk).IsCmd_(typeCmd).TypeKey_(Type_.Canonical_name_by_obj(invk));
|
||||
hash.Add(key, regyItm);
|
||||
typeHash.Add_if_dupe_use_1st(regyItm.TypeKey(), regyItm); // NOTE: changed to allow same Object to be added under different aliases (app, xowa) DATE:2014-06-09;
|
||||
typeHash.AddIfDupeUse1st(regyItm.TypeKey(), regyItm); // NOTE: changed to allow same Object to be added under different aliases (app, xowa) DATE:2014-06-09;
|
||||
}
|
||||
public void Del(String k) {
|
||||
GfsRegyItm itm =(GfsRegyItm)hash.Get_by(k);
|
||||
GfsRegyItm itm =(GfsRegyItm)hash.GetByOrNull(k);
|
||||
if (itm != null) typeHash.Del(itm.TypeKey());
|
||||
hash.Del(k);
|
||||
}
|
||||
@ -42,7 +42,7 @@ class GfsRegy implements Gfo_invk {
|
||||
Ordered_hash hash = Ordered_hash_.New();
|
||||
public static GfsRegy new_() {return new GfsRegy();} GfsRegy() {}
|
||||
}
|
||||
class GfsRegyItm implements Gfo_invk {
|
||||
class GfsRegyItm implements Gfo_invk {
|
||||
public String Key() {return key;} public GfsRegyItm Key_(String v) {key = v; return this;} private String key;
|
||||
public String TypeKey() {return typeKey;} public GfsRegyItm TypeKey_(String v) {typeKey = v; return this;} private String typeKey;
|
||||
public boolean IsCmd() {return isCmd;} public GfsRegyItm IsCmd_(boolean v) {isCmd = v; return this;} private boolean isCmd;
|
||||
|
@ -13,7 +13,7 @@ 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.langs.regxs; import gplx.*; import gplx.langs.*;
|
||||
package gplx.langs.regxs; import gplx.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
public class Regx_adp {
|
||||
@ -39,7 +39,7 @@ public class Regx_adp {
|
||||
: find_bgn + find_len // otherwise search after find_end
|
||||
;
|
||||
}
|
||||
return (Regx_match[])rv.To_ary(Regx_match.class);
|
||||
return (Regx_match[])rv.ToAry(Regx_match.class);
|
||||
}
|
||||
private int flags = FLAG__DOTALL | FLAG__UNICODE_CHARACTER_CLASS;// JRE.7:UNICODE_CHARACTER_CLASS; added during %w fix for en.w:A#; DATE:2015-06-10
|
||||
private Pattern under;
|
||||
|
@ -13,7 +13,7 @@ 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.langs.regxs; import gplx.*; import gplx.langs.*;
|
||||
package gplx.langs.regxs; import gplx.*;
|
||||
import org.junit.*; import gplx.core.tests.*;
|
||||
public class Regx_adp__tst implements TfdsEqListItmStr {
|
||||
@Test public void Match() {
|
||||
@ -82,7 +82,7 @@ public class Regx_adp__tst implements TfdsEqListItmStr {
|
||||
rv.Add(itm.Groups()[j].Val());
|
||||
}
|
||||
}
|
||||
return rv.To_str_ary();
|
||||
return rv.ToStrAry();
|
||||
}
|
||||
public String To_str(Object curObj, Object expdObj) {
|
||||
Regx_match cur = (Regx_match)curObj, expd = (Regx_match)expdObj;
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
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.langs.xmls; import gplx.*; import gplx.langs.*;
|
||||
/*
|
||||
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.langs.xmls; import gplx.*;
|
||||
import org.w3c.dom.NodeList;
|
||||
public interface XmlNdeList {
|
||||
int Count();
|
||||
@ -25,9 +25,9 @@ class XmlNdeList_cls_xml implements XmlNdeList {
|
||||
@gplx.Internal protected XmlNdeList_cls_xml(NodeList list) {this.list = list;} NodeList list;
|
||||
}
|
||||
class XmlNdeList_cls_list implements XmlNdeList {
|
||||
public int Count() {return list.Count();}
|
||||
public int Count() {return list.Len();}
|
||||
public XmlNde Get_at(int i) {return (XmlNde)list.Get_at(i);}
|
||||
public void Add(XmlNde xnde) {list.Add(xnde);}
|
||||
@gplx.Internal protected XmlNdeList_cls_list(int count) {list = List_adp_.New(); list.Resize_bounds(count);} List_adp list;
|
||||
@gplx.Internal protected XmlNdeList_cls_list(int count) {list = List_adp_.New(); list.ResizeBounds(count);} List_adp list;
|
||||
}
|
||||
//#}
|
@ -13,7 +13,7 @@ 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.core.ios; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.ios; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class IoEngine_fil_basic_memory_tst extends IoEngine_fil_basic_base_tst {
|
||||
@Override protected IoEngine engine_() {return IoEngine_.Mem_init_();}
|
||||
@ -40,7 +40,7 @@ public class IoEngine_fil_basic_memory_tst extends IoEngine_fil_basic_base_tst {
|
||||
List_adp list = Tfds.RscDir.XtoNames();
|
||||
// foreach (String s in list)
|
||||
// Tfds.Write(s);
|
||||
list.Del_at(0); // remove drive
|
||||
list.DelAt(0); // remove drive
|
||||
IoEngine_xrg_recycleFil recycleXrg = bin.Send_xrg(fil)
|
||||
.RootDirNames_(list)
|
||||
.AppName_("gplx.test").Time_(DateAdp_.parse_gplx("20100102_115559123")).Uuid_(Guid_adp_.Parse("467ffb41-cdfe-402f-b22b-be855425784b"));
|
||||
|
@ -13,7 +13,7 @@ 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.core.ios; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.ios; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class IoEngine_fil_basic_system_tst extends IoEngine_fil_basic_base_tst {
|
||||
@Override protected void setup_hook() {
|
||||
@ -32,7 +32,7 @@ public class IoEngine_fil_basic_system_tst extends IoEngine_fil_basic_base_tst {
|
||||
fx.tst_ExistsPaths(true, fil);
|
||||
|
||||
IoRecycleBin bin = IoRecycleBin.Instance;
|
||||
List_adp list = root.XtoNames(); list.Del_at(0); // remove drive
|
||||
List_adp list = root.XtoNames(); list.DelAt(0); // remove drive
|
||||
IoEngine_xrg_recycleFil recycleXrg = bin.Send_xrg(fil)
|
||||
.RootDirNames_(list)
|
||||
.AppName_("gplx.test").Time_(DateAdp_.parse_gplx("20100102_115559123")).Uuid_(Guid_adp_.Parse("467ffb41-cdfe-402f-b22b-be855425784b"));
|
||||
|
@ -13,7 +13,7 @@ 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.core.ios; import gplx.*; import gplx.core.*;
|
||||
package gplx.core.ios; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class IoUrl_wnt_tst {
|
||||
IoUrlFxt fx = IoUrlFxt.new_();
|
||||
@ -79,7 +79,7 @@ public class IoUrl_wnt_tst {
|
||||
class IoUrlFxt {
|
||||
public void tst_Xto_api(Io_url url, String expd) {Tfds.Eq(expd, url.Xto_api());}
|
||||
public void tst_OwnerRoot(Io_url url, String expd) {Tfds.Eq(expd, url.OwnerRoot().Raw());}
|
||||
public void tst_XtoNames(Io_url url, String... expdAry) {Tfds.Eq_ary(expdAry, url.XtoNames().To_str_ary());}
|
||||
public void tst_XtoNames(Io_url url, String... expdAry) {Tfds.Eq_ary(expdAry, url.XtoNames().ToStrAry());}
|
||||
public void tst_NameAndExt(Io_url url, String expd) {Tfds.Eq(expd, url.NameAndExt());}
|
||||
public void tst_Xto_gplx(Io_url url, String expd) {Tfds.Eq(expd, url.Raw());}
|
||||
public void tst_IsDir(Io_url url, boolean expd) {Tfds.Eq(expd, url.Type_dir());}
|
||||
|
@ -13,7 +13,8 @@ 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.core.stores.xmls; import gplx.*; import gplx.core.*; import gplx.core.stores.*;
|
||||
package gplx.core.stores.xmls; import gplx.*;
|
||||
import gplx.core.stores.*;
|
||||
import org.junit.*;
|
||||
public class XmlDataRdr_tst {
|
||||
@Test public void Read() {
|
||||
@ -93,7 +94,7 @@ class XmlDataRdr_fxt {
|
||||
while (subRdr.MoveNextPeer())
|
||||
list.Add(subRdr.Read(key));
|
||||
|
||||
String[] actlAry = list.To_str_ary();
|
||||
String[] actlAry = list.ToStrAry();
|
||||
Tfds.Eq_ary(actlAry, expdAry);
|
||||
}
|
||||
public static XmlDataRdr_fxt new_() {return new XmlDataRdr_fxt();} XmlDataRdr_fxt() {}
|
||||
|
@ -13,20 +13,20 @@ 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.gfml; import gplx.*;
|
||||
import gplx.core.texts.*; /*CharStream*/
|
||||
package gplx.gfml; import gplx.*;
|
||||
import gplx.core.texts.*; /*CharStream*/
|
||||
public interface GfmlLxr extends Gfo_evt_itm {
|
||||
String Key();
|
||||
String[] Hooks();
|
||||
GfmlTkn CmdTkn();
|
||||
void CmdTkn_set(GfmlTkn val); // needed for lxr pragma
|
||||
GfmlTkn MakeTkn(CharStream stream, int hookLength);
|
||||
GfmlLxr SubLxr();
|
||||
void SubLxr_Add(GfmlLxr... lexer);
|
||||
}
|
||||
class GfmlLxrRegy {
|
||||
public int Count() {return hash.Count();}
|
||||
public void Add(GfmlLxr lxr) {hash.Add(lxr.Key(), lxr);}
|
||||
public GfmlLxr Get_by(String key) {return (GfmlLxr)hash.Get_by(key);}
|
||||
Hash_adp hash = Hash_adp_.New();
|
||||
}
|
||||
String Key();
|
||||
String[] Hooks();
|
||||
GfmlTkn CmdTkn();
|
||||
void CmdTkn_set(GfmlTkn val); // needed for lxr pragma
|
||||
GfmlTkn MakeTkn(CharStream stream, int hookLength);
|
||||
GfmlLxr SubLxr();
|
||||
void SubLxr_Add(GfmlLxr... lexer);
|
||||
}
|
||||
class GfmlLxrRegy {
|
||||
public int Count() {return hash.Len();}
|
||||
public void Add(GfmlLxr lxr) {hash.Add(lxr.Key(), lxr);}
|
||||
public GfmlLxr Get_by(String key) {return (GfmlLxr)hash.GetByOrNull(key);}
|
||||
Hash_adp hash = Hash_adp_.New();
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ public class GfmlTkn_ {
|
||||
@gplx.Internal protected static GfmlTkn singleton_(String tknType, String raw, String val, GfmlBldrCmd cmd) {return new GfmlTkn_singleton().ctor_GfmlTkn_base(tknType, raw, val, cmd);}
|
||||
@gplx.Internal protected static GfmlTkn composite_(String tknType, GfmlTkn[] ary) {return new GfmlTkn_composite(tknType, ary);}
|
||||
@gplx.Internal protected static GfmlTkn composite_list_(String tknType, GfmlObjList list) {
|
||||
GfmlTkn[] ary = new GfmlTkn[list.Count()];
|
||||
for (int i = 0; i < list.Count(); i++)
|
||||
GfmlTkn[] ary = new GfmlTkn[list.Len()];
|
||||
for (int i = 0; i < list.Len(); i++)
|
||||
ary[i] = (GfmlTkn)list.Get_at(i);
|
||||
return GfmlTkn_.composite_(tknType, ary);
|
||||
}
|
||||
|
@ -1,23 +1,23 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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.gfml; import gplx.*;
|
||||
import gplx.core.texts.*; /*CharStream*/
|
||||
public class GfmlTrie {
|
||||
public String[] Symbols() {
|
||||
String[] rv = new String[symbols.Count()];
|
||||
String[] rv = new String[symbols.Len()];
|
||||
for (int i = 0; i < rv.length; i++)
|
||||
rv[i] = String_.cast(symbols.Get_at(i));
|
||||
return rv;
|
||||
@ -77,7 +77,7 @@ public class GfmlTrie {
|
||||
curLink = foundAsLink;
|
||||
}
|
||||
}
|
||||
symbols.Add_if_dupe_use_nth(symbol, symbol);
|
||||
symbols.AddIfDupeUseNth(symbol, symbol);
|
||||
}
|
||||
public void Del(String symbol) {
|
||||
char[] ary = String_.XtoCharAry(symbol); int lastIndex = ary.length - 1;
|
||||
|
@ -13,20 +13,20 @@ 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.gfml; import gplx.*;
|
||||
package gplx.gfml; import gplx.*;
|
||||
public class GfmlFldList {
|
||||
public int Count() {return hash.Count();}
|
||||
public GfmlFld Get_at(int index) {return (GfmlFld)hash.Get_at(index);}
|
||||
public GfmlFld Get_by(String id) {return (GfmlFld)hash.Get_by(id);}
|
||||
public void Add(GfmlFld fld) {
|
||||
if (String_.Len_eq_0(fld.Name())) throw Err_.new_wo_type("fld name cannot be null");
|
||||
if (hash.Has(fld.Name())) throw Err_.new_wo_type("key already exists", "key", fld.Name()); // FIXME: commented out to allow multiple types with same name; need "_type:invk"
|
||||
hash.Add_if_dupe_use_nth(fld.Name(), fld);
|
||||
}
|
||||
public void Del(GfmlFld fld) {
|
||||
hash.Del(fld);
|
||||
hash.Del(fld.Name());
|
||||
}
|
||||
Ordered_hash hash = Ordered_hash_.New();
|
||||
public static GfmlFldList new_() {return new GfmlFldList();} GfmlFldList() {}
|
||||
}
|
||||
public int Count() {return hash.Len();}
|
||||
public GfmlFld Get_at(int index) {return (GfmlFld)hash.Get_at(index);}
|
||||
public GfmlFld Get_by(String id) {return (GfmlFld)hash.GetByOrNull(id);}
|
||||
public void Add(GfmlFld fld) {
|
||||
if (String_.Len_eq_0(fld.Name())) throw Err_.new_wo_type("fld name cannot be null");
|
||||
if (hash.Has(fld.Name())) throw Err_.new_wo_type("key already exists", "key", fld.Name()); // FIXME: commented out to allow multiple types with same name; need "_type:invk"
|
||||
hash.AddIfDupeUseNth(fld.Name(), fld);
|
||||
}
|
||||
public void Del(GfmlFld fld) {
|
||||
hash.Del(fld);
|
||||
hash.Del(fld.Name());
|
||||
}
|
||||
Ordered_hash hash = Ordered_hash_.New();
|
||||
public static GfmlFldList new_() {return new GfmlFldList();} GfmlFldList() {}
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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.gfml; import gplx.*;
|
||||
class GfmlTypeCompiler {
|
||||
@gplx.Internal protected static GfmlType Compile(GfmlNde nde, GfmlType owner, GfmlTypRegy typeRegy, Ordered_hash results) {return Compile(nde, owner, true, typeRegy, results);}
|
||||
@ -63,7 +63,7 @@ class GfmlTypeCompiler {
|
||||
static GfmlType FetchTypeOrNew(String name, String typeKey, GfmlTypRegy typeRegy, Ordered_hash results) {
|
||||
GfmlType rv = typeRegy.FetchOrNull(typeKey); // look for type in regy to see if it was declared earlier
|
||||
if (rv == GfmlType_.Null) {
|
||||
rv = (GfmlType)results.Get_by(rv.Key()); // look for type in current pragma's results
|
||||
rv = (GfmlType)results.GetByOrNull(rv.Key()); // look for type in current pragma's results
|
||||
if (rv == null) { // nothing found; create and add
|
||||
rv = GfmlType_.new_(typeKey, name);
|
||||
results.Add(typeKey, rv);
|
||||
|
@ -1,21 +1,21 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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.gfml; import gplx.*;
|
||||
class GfmlTypeHash {
|
||||
public GfmlType Get_by(String key) {return (GfmlType)hash.Get_by(key);}
|
||||
class GfmlTypeHash {
|
||||
public GfmlType Get_by(String key) {return (GfmlType)hash.GetByOrNull(key);}
|
||||
public void Add(GfmlType type) {
|
||||
if (type.IsTypeNull()) throw Err_.new_wo_type("cannot add null type to GfmlTypeHash");
|
||||
if (hash.Has(type.Key())) throw Err_.new_wo_type("type key already exists", "key", type.Key());
|
||||
@ -24,7 +24,7 @@ class GfmlTypeHash {
|
||||
Hash_adp hash = Hash_adp_.New();
|
||||
public static GfmlTypeHash new_() {return new GfmlTypeHash();} GfmlTypeHash() {}
|
||||
}
|
||||
class GfmlTypRegy {
|
||||
class GfmlTypRegy {
|
||||
public boolean Has(String typeKey) {return hash.Has(typeKey);}
|
||||
public GfmlType FetchOrNull(String typeKey) {return FetchOrNull(typeKey, GfmlDocPos_.Root);}
|
||||
public GfmlType FetchOrNull(String typeKey, GfmlDocPos pos) {
|
||||
|
@ -1,18 +1,18 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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.gfml; import gplx.*;
|
||||
class GfmlTypeMakr {
|
||||
public GfmlType Owner() {return owner;}
|
||||
@ -37,7 +37,7 @@ class GfmlTypeMakr {
|
||||
}
|
||||
public void AddSubFld(GfmlFld subFld) {AddSubFld_imp(owner, subFld);}
|
||||
public GfmlType[] Xto_bry() {
|
||||
GfmlType[] rv = (GfmlType[])list.To_ary(GfmlType.class);
|
||||
GfmlType[] rv = (GfmlType[])list.ToAry(GfmlType.class);
|
||||
list.Clear();
|
||||
owner = null;
|
||||
return rv;
|
||||
|
@ -1,18 +1,18 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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.gfml; import gplx.*;
|
||||
import gplx.core.lists.*;/*StackAdp*/
|
||||
class GfmlTypeMgr {
|
||||
@ -101,20 +101,20 @@ class GfmlTypeMgr {
|
||||
StackAdp stack = StackAdp_.new_(), ownerNdeStack = StackAdp_.new_();
|
||||
public static GfmlTypeMgr new_() {return new GfmlTypeMgr();} GfmlTypeMgr() {}
|
||||
}
|
||||
class GfmlFldPool {
|
||||
class GfmlFldPool {
|
||||
public GfmlTkn Keyed_PopNextAsTkn() {return GfmlTkn_.val_(Keyed_PopNext().Name());} // helper method for GfmlFrame_nde
|
||||
public GfmlFld Keyed_PopNext() {
|
||||
if (keyedRegy.Count() == 0) return GfmlFld.Null;
|
||||
if (keyedRegy.Len() == 0) return GfmlFld.Null;
|
||||
GfmlFld rv = (GfmlFld)keyedRegy.Get_at(0);
|
||||
keyedRegy.Del(rv.Name());
|
||||
return rv;
|
||||
}
|
||||
public GfmlFld Keyed_PopByKey(String key) {
|
||||
GfmlFld rv = (GfmlFld)keyedRegy.Get_by(key); if (rv == null) return GfmlFld.Null;
|
||||
GfmlFld rv = (GfmlFld)keyedRegy.GetByOrNull(key); if (rv == null) return GfmlFld.Null;
|
||||
keyedRegy.Del(rv.Name());
|
||||
return rv;
|
||||
}
|
||||
@gplx.Internal protected int Keyd_Count() {return keyedRegy.Count();}
|
||||
@gplx.Internal protected int Keyd_Count() {return keyedRegy.Len();}
|
||||
@gplx.Internal protected GfmlFld Keyd_FetchAt(int i) {return (GfmlFld)keyedRegy.Get_at(i);}
|
||||
public GfmlFld DefaultMember() {return defaultMember;} GfmlFld defaultMember = GfmlFld.Null;
|
||||
@gplx.Internal protected GfmlType Type() {return type;} GfmlType type = GfmlType_.Null;
|
||||
|
@ -1,26 +1,26 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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.gfml; import gplx.*;
|
||||
public class GfmlAtr implements GfmlItm {
|
||||
public class GfmlAtr implements GfmlItm {
|
||||
public int ObjType() {return GfmlObj_.Type_atr;}
|
||||
public GfmlTkn KeyTkn() {return keyTkn;} GfmlTkn keyTkn; public String Key() {return keyTkn.Val();}
|
||||
public GfmlTkn DatTkn() {return datTkn;} GfmlTkn datTkn;
|
||||
public GfmlType Type() {return type;} GfmlType type;
|
||||
public boolean KeyedSubObj() {return true;}
|
||||
public int SubObjs_Count() {return subObjs.Count();}
|
||||
public int SubObjs_Count() {return subObjs.Len();}
|
||||
public GfmlObj SubObjs_GetAt(int i) {return (GfmlObj)subObjs.Get_at(i);} GfmlObjList subObjs = GfmlObjList.new_(); // PERF?: make capacity 3 instead of 8
|
||||
public void SubObjs_Add(GfmlObj o) {subObjs.Add(o);}
|
||||
public String To_str() {return String_.Concat(this.Key(), "=", this.DatTkn().Val());}
|
||||
@ -41,13 +41,13 @@ public class GfmlAtr implements GfmlItm {
|
||||
int idx = GetTknIdx(oldTkn);
|
||||
GfmlTkn tkn = MakeTkn(oldTkn, s);
|
||||
if (idx != -1)
|
||||
subObjs.Del_at(idx);
|
||||
subObjs.DelAt(idx);
|
||||
if (idx == -1) idx = 0;
|
||||
subObjs.Add_at(tkn, idx);
|
||||
return tkn;
|
||||
}
|
||||
int GetTknIdx(GfmlTkn t) {
|
||||
for (int i = 0; i < subObjs.Count(); i++) {
|
||||
for (int i = 0; i < subObjs.Len(); i++) {
|
||||
GfmlObj obj = (GfmlObj)subObjs.Get_at(i);
|
||||
if (obj == t) return i;
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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.gfml; import gplx.*;
|
||||
public class GfmlDoc_ {
|
||||
public static GfmlDoc parse_any_eol_(String raw) {return parse(String_.Replace(raw, String_.CrLf, String_.Lf));}
|
||||
@ -35,7 +35,7 @@ class GfmlUsrMsgs {
|
||||
}
|
||||
public static Err gfmlParseError(GfmlBldr bldr) {
|
||||
Err rv = Err_.new_wo_type("gfml parse error");
|
||||
for (int i = 0; i < bldr.Doc().UsrMsgs().Count(); i++) {
|
||||
for (int i = 0; i < bldr.Doc().UsrMsgs().Len(); i++) {
|
||||
UsrMsg um = (UsrMsg)bldr.Doc().UsrMsgs().Get_at(i);
|
||||
rv.Args_add("err" + Int_.To_str(i), um.To_str());
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ 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.gfml; import gplx.*;
|
||||
package gplx.gfml; import gplx.*;
|
||||
public class GfmlItmHnds {
|
||||
public int Count() {return list.Count();} List_adp list = List_adp_.New();
|
||||
public GfmlNde Get_at(int idx) {return (GfmlNde)list.Get_at(idx);}
|
||||
public void Add(GfmlNde nde) {list.Add(nde);}
|
||||
public static GfmlItmHnds new_() {return new GfmlItmHnds();} GfmlItmHnds() {}
|
||||
}
|
||||
public int Count() {return list.Len();} List_adp list = List_adp_.New();
|
||||
public GfmlNde Get_at(int idx) {return (GfmlNde)list.Get_at(idx);}
|
||||
public void Add(GfmlNde nde) {list.Add(nde);}
|
||||
public static GfmlItmHnds new_() {return new GfmlItmHnds();} GfmlItmHnds() {}
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfml; import gplx.*;
|
||||
public class GfmlItmKeys {
|
||||
public int Count() {return list.Count();}
|
||||
public int Count() {return list.Len();}
|
||||
public boolean Has(String key) {return hash.Has(key);}
|
||||
public GfmlItm Get_at(int i) {return (GfmlItm)list.Get_at(i);}
|
||||
public GfmlItm Get_by(String key) {return (GfmlItm)hash.Get_by(key);}
|
||||
public GfmlItm Get_by(String key) {return (GfmlItm)hash.GetByOrNull(key);}
|
||||
public String FetchDataOr(String key, String or) {
|
||||
GfmlAtr atr = FetchAtr(key);
|
||||
return (atr == null) ? or : atr.DatTkn().Val();
|
||||
@ -52,7 +52,7 @@ public class GfmlItmKeys {
|
||||
}
|
||||
if (toDel != null) list.Del(toDel);
|
||||
}
|
||||
GfmlAtr FetchAtr(String key) {return GfmlAtr.as_(hash.Get_by(key));}
|
||||
GfmlAtr FetchAtr(String key) {return GfmlAtr.as_(hash.GetByOrNull(key));}
|
||||
List_adp list = List_adp_.New(); Hash_adp hash = Hash_adp_.New();
|
||||
public static GfmlItmKeys new_() {return new GfmlItmKeys();} GfmlItmKeys() {}
|
||||
@gplx.Internal protected static final String NullKey = "";
|
||||
|
@ -1,27 +1,27 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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.gfml; import gplx.*;
|
||||
public class GfmlNde implements GfmlItm {
|
||||
public class GfmlNde implements GfmlItm {
|
||||
public static final int OBJ_TYPE = GfmlObj_.Type_nde;
|
||||
public int ObjType() {return objType;} int objType = GfmlObj_.Type_nde;
|
||||
public GfmlTkn KeyTkn() {return keyTkn;} public String Key() {return keyTkn.Val();} GfmlTkn keyTkn = GfmlTkn_.Null;
|
||||
public GfmlType Type() {return type;} GfmlType type;
|
||||
public boolean KeyedSubObj() {return keyedSubObj;} public GfmlNde KeyedSubObj_(boolean v) {keyedSubObj = v; return this;} private boolean keyedSubObj;
|
||||
public int ChainId() {return chainId;} public GfmlNde ChainId_(int v) {chainId = v; return this;} int chainId; // can use boolean chainHead, but this is easier for debugging
|
||||
public int SubObjs_Count() {return subObjs.Count();} GfmlObjList subObjs = GfmlObjList.new_();
|
||||
public int SubObjs_Count() {return subObjs.Len();} GfmlObjList subObjs = GfmlObjList.new_();
|
||||
public GfmlObj SubObjs_GetAt(int i) {return (GfmlObj)subObjs.Get_at(i);}
|
||||
public void SubObjs_Add(GfmlObj gobj) {
|
||||
subObjs.Add(gobj);
|
||||
@ -61,8 +61,8 @@ public class GfmlNde implements GfmlItm {
|
||||
// a:{} -> a:{b:{}}
|
||||
}
|
||||
int PosOf(boolean fwd, String... find) {
|
||||
int bgn = fwd ? 0 : subObjs.Count() - 1;
|
||||
int end = fwd ? subObjs.Count() : 0;
|
||||
int bgn = fwd ? 0 : subObjs.Len() - 1;
|
||||
int end = fwd ? subObjs.Len() : 0;
|
||||
int dif = fwd ? 1 : -1;
|
||||
for (int i = bgn; i != end; i+=dif) {
|
||||
GfmlObj subObj = (GfmlObj)subObjs.Get_at(i);
|
||||
|
@ -1,26 +1,26 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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.gfml; import gplx.*;
|
||||
interface GfmlScopeItm {
|
||||
interface GfmlScopeItm {
|
||||
String Key();
|
||||
GfmlDocPos DocPos();
|
||||
}
|
||||
class GfmlScopeRegy {
|
||||
public boolean Has(String key) {
|
||||
GfmlScopeList list = (GfmlScopeList)hash.Get_by(key); if (list == null) return false;
|
||||
GfmlScopeList list = (GfmlScopeList)hash.GetByOrNull(key); if (list == null) return false;
|
||||
return list.Count() > 0;
|
||||
}
|
||||
public void Add(GfmlScopeItm itm) {
|
||||
@ -28,16 +28,16 @@ class GfmlScopeRegy {
|
||||
list.Add(itm);
|
||||
}
|
||||
public void Del(GfmlScopeItm itm) {
|
||||
GfmlScopeList list = (GfmlScopeList)hash.Get_by(itm.Key()); if (list == null) return;
|
||||
GfmlScopeList list = (GfmlScopeList)hash.GetByOrNull(itm.Key()); if (list == null) return;
|
||||
list.Del(itm);
|
||||
if (list.Count() == 0) hash.Del(itm.Key());
|
||||
}
|
||||
public GfmlScopeItm Get_by(String key, GfmlDocPos pos) {
|
||||
GfmlScopeList list = (GfmlScopeList)hash.Get_by(key); if (list == null) return null;
|
||||
GfmlScopeList list = (GfmlScopeList)hash.GetByOrNull(key); if (list == null) return null;
|
||||
return list.Get_by(pos);
|
||||
}
|
||||
GfmlScopeList ItmOrNew(String key) {
|
||||
GfmlScopeList rv = (GfmlScopeList)hash.Get_by(key);
|
||||
GfmlScopeList rv = (GfmlScopeList)hash.GetByOrNull(key);
|
||||
if (rv == null) {
|
||||
rv = GfmlScopeList.new_(key);
|
||||
hash.Add(key, rv);
|
||||
@ -49,11 +49,11 @@ class GfmlScopeRegy {
|
||||
}
|
||||
class GfmlScopeList {
|
||||
public String Key() {return key;} private String key;
|
||||
public int Count() {return list.Count();}
|
||||
public int Count() {return list.Len();}
|
||||
public void Add(GfmlScopeItm itm) {list.Add(itm);}
|
||||
public void Del(GfmlScopeItm itm) {list.Del(itm);}
|
||||
public GfmlScopeItm Get_by(GfmlDocPos pos) {
|
||||
if (list.Count() == 0) return null;
|
||||
if (list.Len() == 0) return null;
|
||||
GfmlScopeItm rv = null;
|
||||
for (Object itemObj : list) {
|
||||
GfmlScopeItm itm = (GfmlScopeItm)itemObj;
|
||||
|
@ -1,30 +1,30 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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.gfml; import gplx.*;
|
||||
import gplx.core.lists.*;/*Hash_adp_list*/
|
||||
interface GfmlPragma {
|
||||
interface GfmlPragma {
|
||||
String KeyOfPragma();
|
||||
void Exec(GfmlBldr bldr, GfmlNde pragmaNde);
|
||||
GfmlType[] MakePragmaTypes(GfmlTypeMakr typeMakr);
|
||||
}
|
||||
class GfmlPragmaMgr {
|
||||
class GfmlPragmaMgr {
|
||||
public void Pragmas_add(GfmlPragma cmd) {pragmas.Add(cmd.KeyOfPragma(), cmd);}
|
||||
public boolean Pragmas_compile(String ndeName, GfmlBldr bldr) {
|
||||
if (pragmas.Count() == 0) return false;
|
||||
GfmlPragma cmd = (GfmlPragma)pragmas.Get_by(ndeName); if (cmd == null) return false;
|
||||
if (pragmas.Len() == 0) return false;
|
||||
GfmlPragma cmd = (GfmlPragma)pragmas.GetByOrNull(ndeName); if (cmd == null) return false;
|
||||
GfmlNde pragmaNde = bldr.CurNde();
|
||||
pragmaNde.ObjType_set_pragma();
|
||||
cmd.Exec(bldr, pragmaNde);
|
||||
@ -37,8 +37,8 @@ class GfmlPragmaMgr {
|
||||
public void EndCmds_del(GfmlDocPos pos, GfmlBldrCmd cmd) {endCmds.DelInList(pos.Path(), cmd);}
|
||||
public void EndCmds_exec(GfmlDocPos pos, GfmlBldr bldr) {Exec(pos, bldr, endCmds);}
|
||||
static void Exec(GfmlDocPos pos, GfmlBldr bldr, Hash_adp_list cmds) {
|
||||
List_adp list = cmds.Get_by(pos.Path()); if (list == null) return;
|
||||
for (int i = 0; i < list.Count(); i++) {
|
||||
List_adp list = cmds.GetByOrNull(pos.Path()); if (list == null) return;
|
||||
for (int i = 0; i < list.Len(); i++) {
|
||||
GfmlBldrCmd cmd = (GfmlBldrCmd)list.Get_at(i);
|
||||
cmd.Exec(bldr, GfmlTkn_.Null);
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
package gplx.gfml; import gplx.*;
|
||||
class GfmlVarCtx {
|
||||
public String Key() {return key;} private String key;
|
||||
public void Add_if_dupe_use_nth(GfmlVarItm itm) {hash.Add_if_dupe_use_nth(itm.Key(), itm);}
|
||||
public void Add_if_dupe_use_nth(GfmlVarItm itm) {hash.AddIfDupeUseNth(itm.Key(), itm);}
|
||||
public void Del(String key) {hash.Del(key);}
|
||||
public String Fetch_Val(String key) {
|
||||
GfmlVarItm itm = (GfmlVarItm)hash.Get_by(key); if (itm == null) return null;
|
||||
GfmlVarItm itm = (GfmlVarItm)hash.GetByOrNull(key); if (itm == null) return null;
|
||||
return itm.TknVal();
|
||||
}
|
||||
Hash_adp hash = Hash_adp_.New();
|
||||
@ -32,7 +32,7 @@ class GfmlVarCtx {
|
||||
class GfmlVarCtx_ {
|
||||
public static GfmlVarCtx FetchFromCacheOrNew(Hash_adp cache, String ctxKey) {
|
||||
Hash_adp ctxRegy = FetchRegyOrNew(cache);
|
||||
GfmlVarCtx rv = (GfmlVarCtx)ctxRegy.Get_by(ctxKey);
|
||||
GfmlVarCtx rv = (GfmlVarCtx)ctxRegy.GetByOrNull(ctxKey);
|
||||
if (rv == null) {
|
||||
rv = (String_.Eq(ctxKey, DefaultKey))
|
||||
? default_(ctxKey)
|
||||
@ -49,7 +49,7 @@ class GfmlVarCtx_ {
|
||||
}
|
||||
static Hash_adp FetchRegyOrNew(Hash_adp cache) {
|
||||
String key = "gfml.cacheKeys.ctxRegy";
|
||||
Hash_adp rv = (Hash_adp)cache.Get_by(key);
|
||||
Hash_adp rv = (Hash_adp)cache.GetByOrNull(key);
|
||||
if (rv == null) {
|
||||
rv = Hash_adp_.New();
|
||||
cache.Add(key, rv);
|
||||
|
@ -1,21 +1,21 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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.gfml; import gplx.*;
|
||||
import gplx.core.texts.*; /*CharStream*/
|
||||
public class GfmlBldr {
|
||||
public class GfmlBldr {
|
||||
@gplx.Internal protected GfmlDoc Doc() {return gdoc;} GfmlDoc gdoc = GfmlDoc.new_();
|
||||
@gplx.Internal protected GfmlFrame CurFrame() {return curFrame;} GfmlFrame curFrame;
|
||||
@gplx.Internal protected GfmlFrame_nde CurNdeFrame() {return curNdeFrame;} GfmlFrame_nde curNdeFrame;
|
||||
@ -39,7 +39,7 @@ public class GfmlBldr {
|
||||
curNdeFrame.Build_end(this, GfmlFrame_nde_.OwnerRoot_);
|
||||
if (frameStack.Count() > 0) UsrMsgs_fail(GfmlUsrMsgs.fail_Frame_danglingBgn());
|
||||
}
|
||||
if (throwErrors && gdoc.UsrMsgs().Count() > 0) throw GfmlUsrMsgs.gfmlParseError(this);
|
||||
if (throwErrors && gdoc.UsrMsgs().Len() > 0) throw GfmlUsrMsgs.gfmlParseError(this);
|
||||
raw = "";
|
||||
return gdoc;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class GfmlBldrCmd_null implements GfmlBldrCmd {
|
||||
}
|
||||
class GfmlBldrCmdRegy {
|
||||
public void Add(GfmlBldrCmd cmd) {hash.Add(cmd.Key(), cmd);}
|
||||
public GfmlBldrCmd GetOrFail(String key) {return (GfmlBldrCmd)hash.Get_by_or_fail(key);}
|
||||
public GfmlBldrCmd GetOrFail(String key) {return (GfmlBldrCmd)hash.GetByOrFail(key);}
|
||||
Hash_adp hash = Hash_adp_.New();
|
||||
public static GfmlBldrCmdRegy new_() {
|
||||
GfmlBldrCmdRegy rv = new GfmlBldrCmdRegy();
|
||||
|
@ -1,18 +1,18 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
/*
|
||||
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.gfml; import gplx.*;
|
||||
class GfmlBldrCmd_pendingTkns_add implements GfmlBldrCmd {
|
||||
public String Key() {return "gfml.pendingTkns_add";}
|
||||
@ -111,12 +111,12 @@ class GfmlBldrCmd_frameEnd implements GfmlBldrCmd {
|
||||
class GfmlBldrCmd_whitespace implements GfmlBldrCmd {
|
||||
public String Key() {return "gfml.whitespace_exec";}
|
||||
public void Exec(GfmlBldr bldr, GfmlTkn tkn) {
|
||||
if (bldr.CurNdeFrame().waitingTkns.Count() > 0) {
|
||||
GfmlObj t = (GfmlObj)bldr.CurNdeFrame().waitingTkns.Get_at(bldr.CurNdeFrame().waitingTkns.Count() - 1);
|
||||
if (bldr.CurNdeFrame().waitingTkns.Len() > 0) {
|
||||
GfmlObj t = (GfmlObj)bldr.CurNdeFrame().waitingTkns.Get_at(bldr.CurNdeFrame().waitingTkns.Len() - 1);
|
||||
if (t.ObjType() == GfmlObj_.Type_nde)
|
||||
bldr.CurNdeFrame().IdxNdeBgn_set(bldr.CurNdeFrame().WaitingTkns().Count() + 1);
|
||||
bldr.CurNdeFrame().IdxNdeBgn_set(bldr.CurNdeFrame().WaitingTkns().Len() + 1);
|
||||
}
|
||||
if (bldr.CurFrame().WaitingTkns().Count() == 0) {
|
||||
if (bldr.CurFrame().WaitingTkns().Len() == 0) {
|
||||
bldr.CurNde().SubObjs_Add(tkn); // if curFrame begins with whitespace, add directly to node (whitespace should not belong to atr)
|
||||
}
|
||||
else
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user