mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Refactor: Clean up Int_ classes
This commit is contained in:
@@ -134,7 +134,7 @@ public class Xob_wiki_cfg_bldr_tst {
|
||||
for (int j = 0; j < xndes_len; j++) {
|
||||
gplx.langs.xmls.XmlNde ns_nde = xnde.SubNdes().Get_at(j);
|
||||
if (!String_.Eq(ns_nde.Name(), "ns")) continue;
|
||||
int id = Int_.parse(ns_nde.Atrs().FetchValOr("id", "-1"));
|
||||
int id = Int_.Parse(ns_nde.Atrs().FetchValOr("id", "-1"));
|
||||
String name = String_.Replace(String_.Replace(ns_nde.Text_inner(), " ", "_"), "'", "''");
|
||||
sb.Add(Int_.To_str(id)).Add("|").Add(String_.Trim(name)).Add_char_nl();
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ public class Xobc_task_step_hash {
|
||||
private final Ordered_hash tasks_hash = Ordered_hash_.New();
|
||||
private final Ordered_hash steps_hash = Ordered_hash_.New();
|
||||
public int Tasks__len() {return tasks_hash.Len();}
|
||||
public int Tasks__get_at(int i) {return Int_.cast(tasks_hash.Get_at(i));}
|
||||
public int Tasks__get_at(int i) {return Int_.Cast(tasks_hash.Get_at(i));}
|
||||
public int Steps__len() {return steps_hash.Len();}
|
||||
public int Steps__get_at(int i) {return Int_.cast(steps_hash.Get_at(i));}
|
||||
public int Steps__get_at(int i) {return Int_.Cast(steps_hash.Get_at(i));}
|
||||
public void Clear() {tasks_hash.Clear(); steps_hash.Clear();}
|
||||
public void Add(int task_id, int step_id) {
|
||||
tasks_hash.Add_if_dupe_use_nth(task_id, task_id);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Split_cfg implements Gfo_invk {
|
||||
}
|
||||
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk__ns_ids_)) this.Ns_itms_(Int_.Ary_parse(m.ReadStr("v"), "|"));
|
||||
if (ctx.Match(k, Invk__ns_ids_)) this.Ns_itms_(Int_ary_.Parse(m.ReadStr("v"), "|"));
|
||||
else if (ctx.Match(k, Invk__loader_rows_)) this.loader_rows = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk__force_rebuild_)) this.force_rebuild = m.ReadBool("v");
|
||||
else if (ctx.Match(k, Invk__trg_max_)) this.trg_max = m.ReadLong("v");
|
||||
|
||||
@@ -33,6 +33,6 @@ public class Split_file_tid_ {
|
||||
int bgn = String_.FindFwd(raw, "ns."); if (bgn == Bry_find_.Not_found) throw Err_.new_wo_type("could not find ns in url", "fil", raw);
|
||||
bgn += 3; // ns.
|
||||
int end = String_.FindFwd(raw, ".", bgn); if (end == Bry_find_.Not_found) throw Err_.new_wo_type("could not find ns in url", "fil", raw);
|
||||
return Int_.parse(String_.Mid(raw, bgn, end));
|
||||
return Int_.Parse(String_.Mid(raw, bgn, end));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Xobldr__fsdb_db__create_data extends Xob_cmd__base implements Xob_c
|
||||
private Xof_bin_mgr src_bin_mgr; private Xof_bin_wkr__fsdb_sql src_fsdb_wkr; private boolean src_bin_mgr__cache_enabled = Bool_.N; private String src_bin_mgr__fsdb_version; private String[] src_bin_mgr__fsdb_skip_wkrs; private boolean src_bin_mgr__wmf_enabled;
|
||||
private Fsm_mnt_itm trg_mnt_itm; private Fsm_cfg_mgr trg_cfg_mgr; private Fsm_atr_fil trg_atr_fil; private Fsm_bin_fil trg_bin_fil; private long trg_bin_db_max; private String trg_bin_mgr__fsdb_version;
|
||||
private final Xof_bin_updater trg_bin_updater = new Xof_bin_updater(); private Xob_bin_db_mgr bin_db_mgr; private int[] ns_ids; private int prv_lnki_tier_id = -1;
|
||||
private long download_size_max = Io_mgr.Len_mb_long * 5; private int[] download_keep_tier_ids = Int_.Ary(0);
|
||||
private long download_size_max = Io_mgr.Len_mb_long * 5; private int[] download_keep_tier_ids = Int_ary_.New(0);
|
||||
private Xobu_poll_mgr poll_mgr; private int poll_interval; private long time_bgn;
|
||||
private int select_interval = 2500, progress_interval = 1, commit_interval = 1, delete_interval = 5000;
|
||||
private boolean exec_done, resume_enabled; private int exec_count, exec_count_max = Int_.Max_value, exec_fail, exec_fail_max = 10000; // 115 errors over 900k images
|
||||
@@ -142,7 +142,7 @@ public class Xobldr__fsdb_db__create_data extends Xob_cmd__base implements Xob_c
|
||||
}
|
||||
else {
|
||||
if (tier_id_bmk == -1) {
|
||||
tier_id_bmk = Int_.parse(tier_id_str);
|
||||
tier_id_bmk = Int_.Parse(tier_id_str);
|
||||
usr_dlg.Note_many("", "", "restoring from bmk: tier_id=~{0}", tier_id_bmk);
|
||||
}
|
||||
if (page_id_bmk == -1) {
|
||||
@@ -312,14 +312,14 @@ public class Xobldr__fsdb_db__create_data extends Xob_cmd__base implements Xob_c
|
||||
else if (ctx.Match(k, Invk_exit_after_commit_)) exit_after_commit = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_exit_now_)) exit_now = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_resume_enabled_)) resume_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_ns_ids_)) ns_ids = Int_.Ary_parse(m.ReadStr("v"), "|");
|
||||
else if (ctx.Match(k, Invk_ns_ids_)) ns_ids = Int_ary_.Parse(m.ReadStr("v"), "|");
|
||||
else if (ctx.Match(k, Invk_src_bin_mgr__fsdb_version_)) src_bin_mgr__fsdb_version = m.ReadStr("v");
|
||||
else if (ctx.Match(k, Invk_src_bin_mgr__fsdb_skip_wkrs_)) src_bin_mgr__fsdb_skip_wkrs = m.ReadStrAry("v", "|");
|
||||
else if (ctx.Match(k, Invk_src_bin_mgr__wmf_enabled_)) src_bin_mgr__wmf_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_src_bin_mgr__cache_enabled_)) src_bin_mgr__cache_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_trg_bin_mgr__fsdb_version_)) trg_bin_mgr__fsdb_version = m.ReadStr("v");
|
||||
else if (ctx.Match(k, Invk_poll_mgr)) return poll_mgr;
|
||||
else if (ctx.Match(k, Invk_download_keep_tier_ids)) download_keep_tier_ids = Int_.Ary_parse(m.ReadStr("v"), "|");
|
||||
else if (ctx.Match(k, Invk_download_keep_tier_ids)) download_keep_tier_ids = Int_ary_.Parse(m.ReadStr("v"), "|");
|
||||
else if (ctx.Match(k, Invk_download_size_max)) download_size_max = Io_size_.To_long_by_msg_mb(m, download_size_max);
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Xobldr__lnki_temp__create extends Xob_dump_mgr_base implements gplx
|
||||
private final Xob_hdump_bldr hdump_bldr = new Xob_hdump_bldr(); private Vnt_convert_lang converter_lang;
|
||||
public Xobldr__lnki_temp__create(Xob_bldr bldr, Xowe_wiki wiki) {this.Cmd_ctor(bldr, wiki);}
|
||||
@Override public byte Init_redirect() {return Bool_.N_byte;} // lnki_temp does not look at redirect pages
|
||||
@Override public int[] Init_ns_ary() {return ns_ids;} private int[] ns_ids = Int_.Ary(Xow_ns_.Tid__main);
|
||||
@Override public int[] Init_ns_ary() {return ns_ids;} private int[] ns_ids = Int_ary_.New(Xow_ns_.Tid__main);
|
||||
@Override protected void Init_reset(Db_conn conn) {
|
||||
Db_cfg_tbl cfg_tbl = gplx.xowa.wikis.data.Xowd_cfg_tbl_.New(conn);
|
||||
cfg_tbl.Delete_all();
|
||||
@@ -157,7 +157,7 @@ public class Xobldr__lnki_temp__create extends Xob_dump_mgr_base implements gplx
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_wdata_enabled_)) wdata_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_xtn_ref_enabled_)) xtn_ref_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_ns_ids_)) ns_ids = Int_.Ary_parse(m.ReadStr("v"), "|");
|
||||
else if (ctx.Match(k, Invk_ns_ids_)) ns_ids = Int_ary_.Parse(m.ReadStr("v"), "|");
|
||||
else if (ctx.Match(k, Invk_ns_ids_by_aliases)) ns_ids = Xobldr__lnki_temp__create_.Ns_ids_by_aliases(wiki, m.ReadStrAry("v", "|"));
|
||||
else if (ctx.Match(k, Invk_gen_html_)) gen_html = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk__load_all_imglinks_)) load_all_imglinks = m.ReadYn("v");
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Xobldr__redirect__create extends Xob_dump_mgr_base {
|
||||
private Db_conn conn; private Xob_redirect_tbl redirect_tbl;
|
||||
private Xodb_mgr_sql db_mgr; private Xop_redirect_mgr redirect_mgr; private Gfo_url_encoder encoder;
|
||||
public Xobldr__redirect__create(Xob_bldr bldr, Xowe_wiki wiki) {this.Cmd_ctor(bldr, wiki); this.Reset_db_y_();}
|
||||
@Override public int[] Init_ns_ary() {return Int_.Ary(Xow_ns_.Tid__file);} // restrict to file ns
|
||||
@Override public int[] Init_ns_ary() {return Int_ary_.New(Xow_ns_.Tid__file);} // restrict to file ns
|
||||
@Override public byte Init_redirect() {return Bool_.Y_byte;} // restrict to redirects
|
||||
@Override protected void Init_reset(Db_conn conn) {
|
||||
Db_cfg_tbl cfg_tbl = gplx.xowa.wikis.data.Xowd_cfg_tbl_.New(conn);
|
||||
|
||||
@@ -37,7 +37,7 @@ class Xobc_info_html extends Xow_special_wtr__base {
|
||||
long total_size = 0;
|
||||
Bry_bfr tmp_size_bfr = Bry_bfr_.New();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
int step_id = Int_.cast(list.Get_at(i));
|
||||
int step_id = Int_.Cast(list.Get_at(i));
|
||||
Xobc_import_step_itm step_itm = data_db.Tbl__import_step().Select_one(step_id);
|
||||
if (i == 0) {
|
||||
wiki_domain = Xow_abrv_xo_.To_itm(step_itm.Wiki_abrv()); // ASSUME: 1st step's wiki is same for all steps
|
||||
|
||||
@@ -29,7 +29,7 @@ class Xomp_init_mgr {
|
||||
mgr_db.Remake();
|
||||
|
||||
// insert ns into cfg; need for lnki_temp.tier in xomp.make
|
||||
mgr_db.Tbl__cfg().Insert_str("", gplx.xowa.addons.bldrs.mass_parses.parses.wkrs.Xomp_parse_wkr.Cfg__ns_ids, Int_.Ary_concat("|", cfg.Ns_ids()));
|
||||
mgr_db.Tbl__cfg().Insert_str("", gplx.xowa.addons.bldrs.mass_parses.parses.wkrs.Xomp_parse_wkr.Cfg__ns_ids, Int_ary_.To_str("|", cfg.Ns_ids()));
|
||||
|
||||
// fill page tbl
|
||||
Db_attach_mgr attach_mgr = new Db_attach_mgr(mgr_conn, new Db_attach_itm("page_db", wiki.Data__core_mgr().Db__core().Conn()));
|
||||
|
||||
@@ -28,7 +28,7 @@ class Xomp_init_mgr_cfg implements Gfo_invk {
|
||||
return rv;
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk__ns_ids_)) ns_ids = Int_.Ary_parse(m.ReadStr("v"), "|");
|
||||
if (ctx.Match(k, Invk__ns_ids_)) ns_ids = Int_ary_.Parse(m.ReadStr("v"), "|");
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class Xomp_html_db_wtr {
|
||||
if (prv_ns_id != ns_id
|
||||
|| ns_itm == null) {
|
||||
prv_ns_id = ns_id;
|
||||
ns_itm = new Xob_ns_file_itm(Xow_db_file_.Tid__html_data, "ns." + Int_.To_str_pad_bgn_zero(ns_id, 3), Int_.Ary(ns_id));
|
||||
ns_itm = new Xob_ns_file_itm(Xow_db_file_.Tid__html_data, "ns." + Int_.To_str_pad_bgn_zero(ns_id, 3), Int_ary_.New(ns_id));
|
||||
}
|
||||
String file_name = is_all_or_few ? "-html.xowa" : ns_itm.Make_file_name();
|
||||
this.html_db = wiki.Data__core_mgr().Dbs__make_by_tid(Xow_db_file_.Tid__html_data, Int_.To_str(ns_id), ns_itm.Nth_db_idx(), file_name);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Xomp_parse_mgr {
|
||||
Xomp_parse_wkr[] wkrs = new Xomp_parse_wkr[wkr_len];
|
||||
|
||||
// init ns_ord_mgr
|
||||
Xomp_ns_ord_mgr ns_ord_mgr = new Xomp_ns_ord_mgr(Int_.Ary_parse(mgr_db.Tbl__cfg().Select_str("", Xomp_parse_wkr.Cfg__ns_ids), "|"));
|
||||
Xomp_ns_ord_mgr ns_ord_mgr = new Xomp_ns_ord_mgr(Int_ary_.Parse(mgr_db.Tbl__cfg().Select_str("", Xomp_parse_wkr.Cfg__ns_ids), "|"));
|
||||
|
||||
// init indexer
|
||||
Xofulltext_indexer_wkr indexer = cfg.Indexer_enabled() ? new Xofulltext_indexer_wkr() : null;
|
||||
@@ -131,7 +131,7 @@ public class Xomp_parse_mgr {
|
||||
} finally {rdr.Rls();}
|
||||
|
||||
// mark ns
|
||||
int[] ns_ids = Int_.Ary_parse(ns_list, ",");
|
||||
int[] ns_ids = Int_ary_.Parse(ns_list, ",");
|
||||
cache.Add_ns_loaded(ns_ids);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user