1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

'v3.3.4.1'

This commit is contained in:
gnosygnu
2016-03-27 23:44:59 -04:00
parent de67253a9c
commit baaef32df2
903 changed files with 13339 additions and 8695 deletions

View File

@@ -29,10 +29,8 @@ public class Bit_heap_rdr_tst {
fxt.Test__get_bool(Bool_.Y).Test__cur( 3, 6, 0);
fxt.Test__get_bool(Bool_.Y).Test__cur( 1, 7, 0);
fxt.Test__get_bool(Bool_.Y).Test__cur( 0, 0, 1);
fxt.Load(0);
fxt.Test__get_bool(Bool_.N).Test__cur( 0, 1, 0);
fxt.Load(6);
fxt.Test__get_bool(Bool_.N).Test__cur( 3, 1, 0);
fxt.Test__get_bool(Bool_.Y).Test__cur( 1, 2, 0);
@@ -40,11 +38,9 @@ public class Bit_heap_rdr_tst {
}
@Test public void Get_byte() {
fxt.Load(255).Test__get_byte(2, 3).Test__cur(63, 2, 0);
fxt.Load(255, 3);
fxt.Test__get_byte(7, 127);
fxt.Test__get_byte(3, 7);
fxt.Load(10);
fxt.Test__get_bool(false);
fxt.Test__get_byte(3, 5);

View File

@@ -37,10 +37,8 @@ public class Bit_heap_wtr_tst {
@Test public void Add_byte_digits() {
fxt.Clear().Add_byte(4, 15).Test__vals(4, 15);
fxt.Clear().Add_byte(7, 127).Add_byte(2, 3).Test__vals(1, 1, 255);
fxt.Clear().Add_byte(3, 7).Add_byte(3, 7).Test__vals(6, 63);
fxt.Clear().Add_byte(6, 63).Add_byte(3, 7).Test__vals(1, 1, 255);
fxt.Clear().Add_byte(3, 6).Add_byte(3, 6).Test__vals(6, 54);
}
@Test public void Add_int_hzip() {

View File

@@ -39,16 +39,3 @@ class Gfo_enum_itm {
public int Sort() {return sort;} private int sort;
public String Xtn() {return xtn;} private String xtn;
}
/*
enum_grps
grp_guid,grp_key,grp_int,grp_name,grp_sort,grp_xtn
0-1-2-3,xowa.wiki,0,wiki,,
enum_itms
grp_int,itm_guid,itm_key,itm_int,itm_name,itm_sort,itm_xtn
1,0-1-2-3,0,en.wikipedia.org,0,enwiki,0,''
class Gfo_enum_mgr {
// public Gui
}
*/

View File

@@ -49,4 +49,36 @@ public class Binary_search_ {
}
return Int_.Min_value; // should only occur if (a) ary's 0th slot is not ""; or (b) some unknown error
}
public static int Search(List_adp__getable list, int list_len, CompareAble val) {
if (list_len == 1) return 0;
int interval = list_len / 2;
int pos = interval - List_adp_.Base1;
int pos_last = list_len - 1;
int pos_prv = -1;
int loop_count = 0;
while (loop_count++ < 32) { // 32 bit integer
CompareAble lo = (CompareAble)list.Get_at(pos);
CompareAble hi = pos + 1 == list_len ? null : (CompareAble)list.Get_at(pos + 1);
int adj = 0;
int lo_comp = val.compareTo(lo);
if (lo_comp == CompareAble_.Less) // val is < lo; search slots below
adj = -1;
else {
if (hi == null) return pos; // hi is null when at last slot in ary
int hi_comp = val.compareTo(hi);
if (hi_comp == CompareAble_.More) // val is > hi; search slots above
adj = 1;
else
return pos; // val is > lo and < hi; return slot
}
interval /= 2;
if (interval == 0) interval = 1; // do not allow 0 intervals; pos must always change;
pos += (interval * adj);
if (pos == 0 && pos_prv == 0) break; // NOTE: this will only happen when 1st member is not ""
if (pos < 0) pos = 0;
else if (pos > pos_last) pos = pos_last;
pos_prv = pos;
}
return Int_.Min_value; // should only occur if (a) ary's 0th slot is not ""; or (b) some unknown error
}
}

View File

@@ -33,7 +33,7 @@ public class StatRng_tst {
//@Test public void Basic() {fx.Test_parse_tmpl_str_test("{{#switch:{{{1}}}|a|b|c=1|d=2}}", "{{test|a}}", "1");}
}
/*
public class Pf_func_switch_tst {
// Mwl_parser_fxt fx = new Mwl_parser_fxt(); Pf_func_lang_rsc rsc = Pf_func_lang_rsc.Instance;
public class Pf_func_switch_tst {
// Mwl_parser_fxt fx = new Mwl_parser_fxt(); Pf_func_lang_rsc rsc = Pf_func_lang_rsc.Instance;
*/

View File

@@ -74,7 +74,6 @@ public class Gfo_url_parser {
protocol_bry = anch = null;
path_bgn = qarg_key_bgn = qarg_val_bgn = anch_bgn = anch_nth_bgn = -1;
segs_ary.Clear(); qargs.Clear();
int pos = src_bgn;
Object protocol_obj = protocols.Match_bgn(src, src_bgn, src_end);
pos = protocols.Match_pos();
@@ -86,7 +85,6 @@ public class Gfo_url_parser {
this.protocol_tid = ((Byte_obj_val)protocol_obj).Val();
this.protocol_bry = Make_bry(src_bgn, pos);
}
area = Area__path;
path_bgn = pos;
while (true) {

View File

@@ -20,10 +20,10 @@ import gplx.core.strings.*;
public class Tst_mgr {
public Tst_mgr ThrowError_n_() {throwError = false; return this;} private boolean throwError = true;
public List_adp Results() {return results;} List_adp results = List_adp_.new_();
public KeyValHash Vars() {return vars;} KeyValHash vars = KeyValHash.new_();
public Object Vars_get_by_key(String key) {return vars.FetchValOr(key, null);}
public Keyval_hash Vars() {return vars;} Keyval_hash vars = new Keyval_hash();
public Object Vars_get_by_key(String key) {return vars.Get_val_or(key, null);}
public String Vars_get_bry_as_str(String key, int bgn, int end) {
byte[] bry = (byte[])vars.FetchValOr(key, null); if (bry == null) return String_.Empty;
byte[] bry = (byte[])vars.Get_val_or(key, null); if (bry == null) return String_.Empty;
if (bgn < 0 || end > bry.length || end < bgn || end < 0) return "<<OUT OF BOUNDS>>";
return String_.new_u8(Bry_.Mid(bry, bgn, end));
}

View File

@@ -42,7 +42,7 @@ public class Gfo_thread_cmd_replace implements Gfo_thread_cmd {
String raw = Io_mgr.Instance.LoadFilStr(fil);
int pairs_len = pairs.Count();
for (int i = 0; i < pairs_len; i++) {
KeyVal kv = (KeyVal)pairs.Get_at(i);
Keyval kv = (Keyval)pairs.Get_at(i);
raw = String_.Replace(raw, kv.Key(), kv.Val_to_str_or_null());
}
Io_mgr.Instance.SaveFilStr(fil, raw);
@@ -53,7 +53,7 @@ public class Gfo_thread_cmd_replace implements Gfo_thread_cmd {
if (ctx.Match(k, Invk_async_bgn)) Exec_find_replace();
else if (ctx.Match(k, Invk_owner)) return owner;
else if (ctx.Match(k, Invk_fil_)) fil = Bry_fmtr_eval_mgr_.Eval_url(url_eval_mgr, m.ReadBry("v"));
else if (ctx.Match(k, Invk_add)) pairs.Add(KeyVal_.new_(m.ReadStr("find"), m.ReadStr("replace")));
else if (ctx.Match(k, Invk_add)) pairs.Add(Keyval_.new_(m.ReadStr("find"), m.ReadStr("replace")));
else return GfoInvkAble_.Rv_unhandled;
return this;
} private static final String Invk_async_bgn = "async_bgn", Invk_owner = "owner", Invk_fil_ = "fil_", Invk_add = "add";