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

Refactor: Refactor Dbmeta classes; Rename methods of list and hash classes

This commit is contained in:
gnosygnu
2021-12-01 07:49:25 -05:00
parent 231e10bc19
commit 197e0aa863
846 changed files with 8560 additions and 8513 deletions

View File

@@ -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 Gfo_cache_mgr {
private final Ordered_hash hash = Ordered_hash_.New_bry();
private final List_adp tmp_delete = List_adp_.New();
@@ -27,11 +27,11 @@ public class Gfo_cache_mgr {
}
}
public Object Get_by_key(byte[] key) {
Object o = hash.Get_by(key);
Object o = hash.GetByOrNull(key);
return o == null ? null : ((Gfo_cache_data)o).Val_and_update();
}
public void Add_replace(byte[] key, Rls_able val, int size) {
Object o = hash.Get_by(key);
Object o = hash.GetByOrNull(key);
if (o == null)
Add(key, val, size);
else {

View File

@@ -13,17 +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.caches; import gplx.*; import gplx.core.*;
package gplx.core.caches; import gplx.*;
public class Gfo_cache_mgr_base {
private final Ordered_hash hash = Ordered_hash_.New_bry();
public int Compress_max() {return compress_max;} public void Compress_max_(int v) {compress_max = v;} private int compress_max = 16;
public int Compress_to() {return compress_to;} public void Compress_to_(int v) {compress_to = v;} private int compress_to = 8;
protected Object Base_get_or_null(byte[] key) {
Object rv_obj = hash.Get_by(key);
Object rv_obj = hash.GetByOrNull(key);
return rv_obj == null ? null : ((Gfo_cache_itm_bry)rv_obj).Val();
}
protected void Base_add(byte[] key, Object val) {
if (hash.Count() >= compress_max) Compress();
if (hash.Len() >= compress_max) Compress();
Gfo_cache_itm_bry itm = new Gfo_cache_itm_bry(key, val);
hash.Add(key, itm);
}
@@ -32,7 +32,7 @@ public class Gfo_cache_mgr_base {
}
public void Compress() {
hash.Sort_by(Gfo_cache_itm_comparer.Touched_asc);
int del_len = hash.Count() - compress_to;
int del_len = hash.Len() - compress_to;
List_adp del_list = List_adp_.New();
for (int i = 0; i < del_len; i++) {
Gfo_cache_itm_bry itm = (Gfo_cache_itm_bry)hash.Get_at(i);

View File

@@ -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.consoles; import gplx.*; import gplx.core.*;
package gplx.core.consoles; import gplx.*;
public class Gfo_cmd_arg_mgr {
private final Ordered_hash hash = Ordered_hash_.New();
private final List_adp err_list = List_adp_.New(), tmp_vals = List_adp_.New();
@@ -23,7 +23,7 @@ public class Gfo_cmd_arg_mgr {
this.Clear();
}
public void Clear() {
int len = hash.Count();
int len = hash.Len();
for (int i = 0; i < len; ++i) {
Gfo_cmd_arg_itm itm = (Gfo_cmd_arg_itm)hash.Get_at(i);
itm.Clear();
@@ -31,17 +31,17 @@ public class Gfo_cmd_arg_mgr {
err_list.Clear();
}
public Gfo_cmd_arg_mgr Reg_many(Gfo_cmd_arg_itm... ary) {for (Gfo_cmd_arg_itm itm : ary) Reg(itm); return this;}
public int Len() {return hash.Count();}
public int Len() {return hash.Len();}
public boolean Has(String k) {
Gfo_cmd_arg_itm arg = (Gfo_cmd_arg_itm)hash.Get_by(k);
Gfo_cmd_arg_itm arg = (Gfo_cmd_arg_itm)hash.GetByOrNull(k);
return arg != null && arg.Dirty();
}
public boolean Get_by_as_bool(String k) {
Gfo_cmd_arg_itm arg = (Gfo_cmd_arg_itm)hash.Get_by(k);
Gfo_cmd_arg_itm arg = (Gfo_cmd_arg_itm)hash.GetByOrNull(k);
return arg != null && arg.Val() != null && arg.Val_as_bool();
}
public Gfo_cmd_arg_itm Get_at(int i) {return (Gfo_cmd_arg_itm)hash.Get_at(i);}
public Gfo_cmd_arg_itm Get_by(String key) {return (Gfo_cmd_arg_itm)hash.Get_by(key);}
public Gfo_cmd_arg_itm Get_by(String key) {return (Gfo_cmd_arg_itm)hash.GetByOrNull(key);}
public void Parse(String[] orig_ary) {
this.Clear();
this.orig_ary = orig_ary; int orig_len = orig_ary.length;
@@ -53,13 +53,13 @@ public class Gfo_cmd_arg_mgr {
boolean itm_is_key = String_.Has_at_bgn(itm, Key_prefix); // has "--" -> is key
if ( cur_itm != null // pending itm
&& (itm_is_key || done)) { // cur arg is key ("--key2"), or all done
cur_itm.Val_(Gfo_cmd_arg_mgr_.Parse_ary_to_str(this, cur_itm.Val_tid(), tmp_vals.To_str_ary_and_clear()));
cur_itm.Val_(Gfo_cmd_arg_mgr_.Parse_ary_to_str(this, cur_itm.Val_tid(), tmp_vals.ToStrAryAndClear()));
cur_itm = null;
}
if (done) break;
if (itm_is_key) {
String key = String_.Mid(itm, prefix_len);
Object o = hash.Get_by(key); if (o == null) {Errs__add(Gfo_cmd_arg_mgr_.Err__key__unknown , key); continue;}
Object o = hash.GetByOrNull(key); if (o == null) {Errs__add(Gfo_cmd_arg_mgr_.Err__key__unknown , key); continue;}
cur_itm = (Gfo_cmd_arg_itm)o; if (cur_itm.Dirty()) {Errs__add(Gfo_cmd_arg_mgr_.Err__key__duplicate , key); continue;}
}
else {
@@ -69,7 +69,7 @@ public class Gfo_cmd_arg_mgr {
}
// calc .Reqd and .Dflt
int len = hash.Count();
int len = hash.Len();
for (int i = 0; i < len; ++i) {
cur_itm = (Gfo_cmd_arg_itm)hash.Get_at(i);
if (!cur_itm.Dirty()) { // arg not passed
@@ -80,9 +80,9 @@ public class Gfo_cmd_arg_mgr {
}
}
}
public boolean Errs__exist() {return err_list.Count() > 0;}
public boolean Errs__exist() {return err_list.Len() > 0;}
public void Errs__add(String key, String val) {err_list.Add(key + ": " + val);}
public String[] Errs__to_str_ary() {return err_list.To_str_ary();}
public String[] Errs__to_str_ary() {return err_list.ToStrAry();}
public Gfo_cmd_arg_itm[] To_ary() {return (Gfo_cmd_arg_itm[])hash.To_ary(Gfo_cmd_arg_itm.class);}
private void Reg(Gfo_cmd_arg_itm defn) {hash.Add(defn.Key(), defn);}
public static final String Key_prefix = "--"; private static final int prefix_len = 2;

View File

@@ -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.consoles; import gplx.*; import gplx.core.*;
package gplx.core.consoles; import gplx.*;
import org.junit.*; import gplx.core.tests.*; import gplx.core.envs.*;
public class Gfo_cmd_arg_mgr_tst {
@Before public void init() {fxt.Clear();} private final Gfo_cmd_arg_mgr_fxt fxt = new Gfo_cmd_arg_mgr_fxt();
@@ -100,7 +100,7 @@ class Gfo_cmd_arg_mgr_fxt {
return this;
}
public Gfo_cmd_arg_mgr_fxt Test_write(String... expd) {
Tfds.Eq_ary_str(expd, ((Gfo_usr_dlg__gui_mock)usr_dlg.Gui_wkr()).Msgs().To_str_ary_and_clear());
Tfds.Eq_ary_str(expd, ((Gfo_usr_dlg__gui_mock)usr_dlg.Gui_wkr()).Msgs().ToStrAryAndClear());
return this;
}
public void Test_val_as_url_rel_dir_or(String root_dir, String dir_spr, String val, String expd) {

View File

@@ -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.data_stores; import gplx.*; import gplx.core.*;
package gplx.core.data_stores; import gplx.*;
public class Gfo_data_store {
private final Hash_adp hash = Hash_adp_.New();
public Gfo_data_itm Get_or_null(String key) {
return (Gfo_data_itm)hash.Get_by(key);
return (Gfo_data_itm)hash.GetByOrNull(key);
}
public void Set(Gfo_data_itm itm) {
hash.Add_if_dupe_use_nth(itm.Key(), itm);
hash.AddIfDupeUseNth(itm.Key(), itm);
}
public void Clear() {
hash.Clear();

View File

@@ -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
*/
package gplx.core.gfobjs; 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.gfobjs; import gplx.*;
public class Gfobj_nde implements Gfobj_grp {
private Ordered_hash subs;
public byte Grp_tid() {return Gfobj_grp_.Grp_tid__nde;}
public int Len() {return subs == null ? 0 : subs.Len();}
public Gfobj_fld Get_at(int i) {return subs == null ? null : (Gfobj_fld)subs.Get_at(i);}
public Gfobj_fld Get_by(String k) {return subs == null ? null : (Gfobj_fld)subs.Get_by(k);}
public Gfobj_fld Get_by(String k) {return subs == null ? null : (Gfobj_fld)subs.GetByOrNull(k);}
public Gfobj_ary Get_ary(String k) {return ((Gfobj_fld_ary)Get_by(k)).As_ary();}
public Gfobj_nde Get_nde(int i) {return ((Gfobj_fld_nde)Get_at(i)).As_nde();}
public Gfobj_nde Get_nde(String k) {return ((Gfobj_fld_nde)Get_by(k)).As_nde();}

View File

@@ -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.*; import gplx.core.envs.*;
public class Io_line_rdr_tst {
Io_line_rdr_fxt fxt;
@@ -88,7 +88,7 @@ class Io_line_rdr_fxt {
else
break;
}
Tfds.Eq_ary_str(expd, lines.To_str_ary());
Tfds.Eq_ary_str(expd, lines.ToStrAry());
return this;
}
}

View File

@@ -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.envs.*;
import gplx.core.lists.*;
public class Io_sort {
@@ -30,11 +30,11 @@ public class Io_sort {
int size_new = size_cur + size_row;
if (size_new > memory_max || !reading) {
usr_dlg.Prog_none(GRP_KEY, "sort", "sorting chunk");
row_list.Sort_by(row_comparer);
row_list.SortBy(row_comparer);
Io_url trg_url = trg_fil_gen.Nxt_url();
usr_dlg.Prog_one(GRP_KEY, "write", "writing chunk: ~{0}", trg_url.Raw());
Split_flush(trg_url, row_list, memory_max, bfr, rv);
row_list.Resize_bounds(16); // MEM: resize bounds manually; note that each Flush-set may have widely disparately #of rows (EX: 1 row with a million pages vs. 1 million rows with 1 page)
row_list.ResizeBounds(16); // MEM: resize bounds manually; note that each Flush-set may have widely disparately #of rows (EX: 1 row with a million pages vs. 1 million rows with 1 page)
size_new = size_row; System_.Garbage_collect();
if (!reading) break;
}
@@ -42,7 +42,7 @@ public class Io_sort {
size_cur = size_new;
}
rdr.Rls(); bfr.Rls(); System_.Garbage_collect();
return (Io_url[])rv.To_ary(Io_url.class);
return (Io_url[])rv.ToAry(Io_url.class);
}
public void Merge(Gfo_usr_dlg usr_dlg, Io_url[] src_ary, ComparerAble comparer, Io_line_rdr_key_gen key_gen, Io_sort_cmd cmd) {
BinaryHeap_Io_line_rdr heap = load_(usr_dlg, src_ary, comparer, key_gen, memory_max); if (heap.Len() == 0) return;//throw Err_.new_wo_type(Array_.To_str(src_ary));
@@ -65,7 +65,7 @@ public class Io_sort {
heap.Rls();
}
private static void Split_flush(Io_url url, List_adp list, int max, Bry_bfr tmp, List_adp url_list) {
int len = list.Count();
int len = list.Len();
for (int i = 0; i < len; i++) {
Io_sort_split_itm itm = (Io_sort_split_itm)list.Get_at(i);
int add_len = itm.Row_end() - itm.Row_bgn();

View File

@@ -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 Io_sort_misc_tst {
@Before public void init() {
@@ -27,7 +27,7 @@ public class Io_sort_misc_tst {
Io_url_gen wkr = Io_url_gen_.dir_(dir, fmt, digits);
for (int i = 0; i < calls; i++)
actl_list.Add(wkr.Nxt_url().Raw());
String[] actl = actl_list.To_str_ary();
String[] actl = actl_list.ToStrAry();
for (int i = 0; i < expd.length; i++)
expd[i] = dir_str + expd[i];
Tfds.Eq_ary_str(expd, actl);

View File

@@ -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 gplx.core.primitives.*;
public class HashByInt {
private final Ordered_hash hash = Ordered_hash_.New();
@@ -30,13 +30,13 @@ public class HashByInt {
}
public Object Get_by_or_fail(int key) {
synchronized (tmp_key) {
HashByIntItem item = (HashByIntItem)hash.Get_by_or_fail(tmp_key.Val_(key));
HashByIntItem item = (HashByIntItem)hash.GetByOrFail(tmp_key.Val_(key));
return item.val;
}
}
public Object Get_by_or_null(int key) {
synchronized (tmp_key) {
HashByIntItem item = (HashByIntItem)hash.Get_by(tmp_key.Val_(key));
HashByIntItem item = (HashByIntItem)hash.GetByOrNull(tmp_key.Val_(key));
return item == null ? null : item.val;
}
}

View File

@@ -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.lists.caches; import gplx.*; import gplx.core.*; import gplx.core.lists.*;
package gplx.core.lists.caches; import gplx.*;
import gplx.core.lists.*;
import gplx.core.logs.*;
public class Mru_cache_mgr {
private final Mru_cache_time_mgr time_mgr;
@@ -34,10 +35,10 @@ public class Mru_cache_mgr {
}
public long Cache_max() {return cache_max;} public void Cache_max_(long v) {this.cache_max = v;}
public Object Get_or_null(String key) {
Object itm_obj = key_hash.Get_by(key);
Object itm_obj = key_hash.GetByOrNull(key);
if (itm_obj == null) return null;
Mru_cache_itm itm = (Mru_cache_itm)itm_obj;
dirty.Add_if_dupe_use_1st(key, itm);
dirty.AddIfDupeUse1st(key, itm);
itm.Dirty(time_mgr.Now());
return itm.Val();
}

View File

@@ -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.net; import gplx.*; import gplx.core.*;
package gplx.core.net; import gplx.*;
public class Gfo_inet_conn_ {
public static final int Tid__http = 1, Tid__mem__hash = 2, Tid__mem__pile = 3;
public static Gfo_inet_conn new_http() {return new Gfo_inet_conn__http();}
@@ -34,7 +34,7 @@ class Gfo_inet_conn__mem__hash implements Gfo_inet_conn {
public int Tid() {return Gfo_inet_conn_.Tid__mem__hash;}
public void Clear() {hash.Clear();}
public void Upload_by_bytes(String url, byte[] data) {hash.Add(url, data);}
public byte[] Download_as_bytes_or_null(String url) {return (byte[])hash.Get_by(url);}
public byte[] Download_as_bytes_or_null(String url) {return (byte[])hash.GetByOrNull(url);}
}
class Gfo_inet_conn__mem__pile implements Gfo_inet_conn {
private final List_adp pile = List_adp_.New();

View File

@@ -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.net; 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.net; import gplx.*;
public class Gfo_protocol_itm {
public Gfo_protocol_itm(byte tid, String text) {
this.tid = tid;
@@ -113,7 +113,7 @@ public class Gfo_protocol_itm {
}
public static Gfo_protocol_itm[] Ary() {
if (protocol_itm_ary == null) {
int len = Regy.Count();
int len = Regy.Len();
protocol_itm_ary = new Gfo_protocol_itm[len];
for (int i = 0; i < len; i++)
protocol_itm_ary[i] = (Gfo_protocol_itm)Regy.Get_at(i);
@@ -122,7 +122,7 @@ public class Gfo_protocol_itm {
} private static Gfo_protocol_itm[] protocol_itm_ary;
public static String[] Protocol_str_ary() {
if (protocol_str_ary == null) {
int len = Regy.Count();
int len = Regy.Len();
protocol_str_ary = new String[len];
for (int i = 0; i < len; i++)
protocol_str_ary[i] = ((Gfo_protocol_itm)Regy.Get_at(i)).Text_str();

View File

@@ -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.net; import gplx.*; import gplx.core.*;
package gplx.core.net; import gplx.*;
import gplx.core.btries.*;
import gplx.core.net.qargs.*;
import gplx.langs.htmls.encoders.*;
@@ -122,7 +122,7 @@ public class Gfo_url_parser {
segs_list.Add(Make_bry(encoded, src, seg_bgn, seg_end));
// build url and return it
return new Gfo_url(src, protocol_tid, protocol_bry, (byte[][])segs_list.To_ary_and_clear(byte[].class), qarg_ary, anch);
return new Gfo_url(src, protocol_tid, protocol_bry, (byte[][])segs_list.ToAryAndClear(byte[].class), qarg_ary, anch);
}
private Gfo_qarg_itm[] Make_qarg_ary(byte[] src, int qarg_bgn, int qarg_end) {
// init
@@ -143,7 +143,7 @@ public class Gfo_url_parser {
break;
case Byte_ascii.Null: // "EOS" makes qarg as long as "=" seen or at least one qarg; specifically, "A?B" shouldn't make qarg
if ( val_bgn != -1 // "=" seen; EX: "?A=B"
|| qargs_list.Count() > 0) // at least one qarg exists; EX: "?A=B&C"
|| qargs_list.Len() > 0) // at least one qarg exists; EX: "?A=B&C"
make_qarg = true;
break;
case Byte_ascii.Eq:
@@ -174,7 +174,7 @@ public class Gfo_url_parser {
if (b_is_last) break;
++qarg_pos;
}
return (Gfo_qarg_itm[])qargs_list.To_ary_and_clear(Gfo_qarg_itm.class);
return (Gfo_qarg_itm[])qargs_list.ToAryAndClear(Gfo_qarg_itm.class);
}
private byte[] Make_bry(boolean encoded, byte[] src, int bgn, int end) {
return encoded ? Gfo_url_encoder_.Xourl.Decode(tmp_bfr, Bool_.N, src, bgn, end).To_bry_and_clear() : Bry_.Mid(src, bgn, end);

View File

@@ -13,13 +13,13 @@ 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.net; import gplx.*; import gplx.core.*;
public class Http_post_data_hash {
private final Ordered_hash hash = Ordered_hash_.New_bry();
public int Len() {return hash.Count();}
public Http_post_data_itm Get_at(int i) {return (Http_post_data_itm)hash.Get_at(i);}
public Http_post_data_itm Get_by(byte[] k) {return (Http_post_data_itm)hash.Get_by(k);}
public void Add(byte[] key, byte[] val) {
hash.Add(key, new Http_post_data_itm(key, val));
}
}
package gplx.core.net; import gplx.*;
public class Http_post_data_hash {
private final Ordered_hash hash = Ordered_hash_.New_bry();
public int Len() {return hash.Len();}
public Http_post_data_itm Get_at(int i) {return (Http_post_data_itm)hash.Get_at(i);}
public Http_post_data_itm Get_by(byte[] k) {return (Http_post_data_itm)hash.GetByOrNull(k);}
public void Add(byte[] key, byte[] val) {
hash.Add(key, new Http_post_data_itm(key, val));
}
}

View File

@@ -13,33 +13,33 @@ 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.net.qargs; import gplx.*; import gplx.core.*; import gplx.core.net.*;
package gplx.core.net.qargs; import gplx.*;
import gplx.langs.htmls.encoders.*;
public class Gfo_qarg_mgr_old {
private final List_adp list = List_adp_.New();
private final Hash_adp hash = Hash_adp_bry.cs();
public int Len() {return list.Count();}
public int Len() {return list.Len();}
public boolean Match(byte[] key, byte[] val) {
Gfo_qarg_itm arg = (Gfo_qarg_itm)hash.Get_by(key);
Gfo_qarg_itm arg = (Gfo_qarg_itm)hash.GetByOrNull(key);
return arg == null ? false : Bry_.Eq(val, arg.Val_bry());
}
public Gfo_qarg_itm Get_at(int i) {return (Gfo_qarg_itm)list.Get_at(i);}
public Gfo_qarg_itm Get_arg(byte[] key) {return (Gfo_qarg_itm)hash.Get_by(key);}
public Gfo_qarg_itm Get_arg(byte[] key) {return (Gfo_qarg_itm)hash.GetByOrNull(key);}
public int Get_val_int_or(byte[] key, int or) {
byte[] val_bry = Get_val_bry_or(key, null); if (val_bry == null) return or;
return Bry_.To_int_or(val_bry, or);
}
public byte[] Get_val_bry_or(byte[] key, byte[] or) {
Gfo_qarg_itm arg = (Gfo_qarg_itm)hash.Get_by(key);
Gfo_qarg_itm arg = (Gfo_qarg_itm)hash.GetByOrNull(key);
return arg == null ? or : arg.Val_bry();
}
public String Get_val_str_or(byte[] key, String or) {
Gfo_qarg_itm arg = (Gfo_qarg_itm)hash.Get_by(key);
Gfo_qarg_itm arg = (Gfo_qarg_itm)hash.GetByOrNull(key);
return arg == null ? or : String_.new_u8(arg.Val_bry());
}
public void Set_val_by_int(byte[] key, int val) {Set_val_by_bry(key, Bry_.new_a7(Int_.To_str(val)));}
public void Set_val_by_bry(byte[] key, byte[] val) {
Gfo_qarg_itm arg = (Gfo_qarg_itm)hash.Get_by(key);
Gfo_qarg_itm arg = (Gfo_qarg_itm)hash.GetByOrNull(key);
if (arg == null) {
arg = new Gfo_qarg_itm(key, Bry_.Empty);
list.Add(arg);
@@ -54,11 +54,11 @@ public class Gfo_qarg_mgr_old {
for (int i = 0; i < len; ++i) {
Gfo_qarg_itm itm = ary[i];
list.Add(itm);
hash.Add_if_dupe_use_nth(itm.Key_bry(), itm);
hash.AddIfDupeUseNth(itm.Key_bry(), itm);
}
return this;
}
public Gfo_qarg_itm[] To_ary() {return (Gfo_qarg_itm[])list.To_ary(Gfo_qarg_itm.class);}
public Gfo_qarg_itm[] To_ary() {return (Gfo_qarg_itm[])list.ToAry(Gfo_qarg_itm.class);}
public byte[] Concat(Bry_bfr bfr, byte[]... ary) {
int ary_len = ary.length;
for (int i = 0; i < ary_len; i++) {
@@ -69,13 +69,13 @@ public class Gfo_qarg_mgr_old {
return bfr.To_bry_and_clear();
}
public byte[] To_bry() {
int len = list.Count(); if (len == 0) return Bry_.Empty;
int len = list.Len(); if (len == 0) return Bry_.Empty;
Bry_bfr bfr = Bry_bfr_.New();
To_bry(bfr, gplx.langs.htmls.encoders.Gfo_url_encoder_.Href, false);
return bfr.To_bry_and_clear();
}
public void To_bry(Bry_bfr bfr, Gfo_url_encoder href_encoder, boolean encode) {
int len = list.Count(); if (len == 0) return;
int len = list.Len(); if (len == 0) return;
for (int i = 0; i < len; ++i) {
Gfo_qarg_itm itm = (Gfo_qarg_itm)list.Get_at(i);
bfr.Add_byte(i == 0 ? Byte_ascii.Question : Byte_ascii.Amp);

View File

@@ -13,17 +13,16 @@ 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.*;
import gplx.core.brys.*;
package gplx.core.primitives; import gplx.*;
public class Bry_cache {
private final Hash_adp hash = Hash_adp_.New(); private final Bry_obj_ref hash_ref = Bry_obj_ref.New_empty();
public byte[] Get_or_new(String v) {return Get_or_new(Bry_.new_u8(v));}
public byte[] Get_or_new(byte[] v) {
if (v.length == 0) return Bry_.Empty;
Object rv = hash.Get_by(hash_ref.Val_(v));
Object rv = hash.GetByOrNull(hash_ref.Val_(v));
if (rv == null) {
Bry_obj_ref bry = Bry_obj_ref.New(v);
hash.Add_as_key_and_val(bry);
hash.AddAsKeyAndVal(bry);
return v;
}
else

View File

@@ -13,11 +13,11 @@ 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.*;
package gplx.core.primitives; import gplx.*;
public class Hash_adp__primitive {
private final Hash_adp hash = Hash_adp_.New();
public byte Get_by_str_or_max(String key) {
Byte_obj_val rv = (Byte_obj_val)hash.Get_by(key);
Byte_obj_val rv = (Byte_obj_val)hash.GetByOrNull(key);
return rv == null ? Byte_.Max_value_127 : rv.Val();
}
public Hash_adp__primitive Add_byte(String key, byte val) {

View File

@@ -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.primitives; import gplx.*; import gplx.core.*;
package gplx.core.primitives; import gplx.*;
public class Int_pool {
private final List_adp available_list = List_adp_.New(); private int available_len;
// private final Bry_bfr dbg_bfr = Bry_bfr_.New();
@@ -53,7 +53,7 @@ public class Int_pool {
for (int i = 0; i < available_len; ++i) {
Int_obj_val itm = (Int_obj_val)available_list.Get_at(i);
if (i != itm.Val())
throw Err_.new_("core", "available_list out of order", "contents", available_list.To_str());
throw Err_.new_("core", "available_list out of order", "contents", available_list.ToStr());
}
// dbg_bfr.Add_str("-:c:").Add_int_variable(v).Add_byte_nl();
this.Clear();

View File

@@ -13,15 +13,15 @@ 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.progs.rates; import gplx.*; import gplx.core.*; import gplx.core.progs.*;
package gplx.core.progs.rates; import gplx.*;
public class Gfo_rate_mgr {
private final Hash_adp hash = Hash_adp_.New();
private final int dflt_size;
public Gfo_rate_mgr(int dflt_size) {this.dflt_size = dflt_size;}
public void Clear() {hash.Clear();}
public int Len() {return hash.Count();}
public int Len() {return hash.Len();}
public Gfo_rate_list Get_or_new(String k) {
Gfo_rate_list rv = (Gfo_rate_list)hash.Get_by(k);
Gfo_rate_list rv = (Gfo_rate_list)hash.GetByOrNull(k);
if (rv == null) {
rv = new Gfo_rate_list(dflt_size);
rv.Add(1024 * 1024, 1); // add default rate of 1 MB per second

View File

@@ -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.files; import gplx.*; import gplx.core.*; import gplx.core.security.*;
package gplx.core.security.files; import gplx.*;
import gplx.core.security.algos.*;
public class Cksum_list {
public Cksum_list(byte type, Cksum_itm[] itms, long itms_size) {
@@ -60,7 +60,7 @@ public class Cksum_list {
Cksum_itm itm = new Cksum_itm(hash, file_url, file_size);
list.Add(itm);
}
return new Cksum_list(type, (Cksum_itm[])list.To_ary_and_clear(Cksum_itm.class), itms_size);
return new Cksum_list(type, (Cksum_itm[])list.ToAryAndClear(Cksum_itm.class), itms_size);
}
private static Io_url GenSubFil_nest(Io_url dir, byte[] src) { // split "a/b/c" or "a\b\c" -> [a, b, c]
byte dir_spr = gplx.core.envs.Op_sys.Lnx.Fsys_dir_spr_byte();

View File

@@ -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 Tst_mgr {
public Tst_mgr ThrowError_n_() {throwError = false; return this;} private boolean throwError = true;
@@ -89,7 +89,7 @@ public class Tst_mgr {
String Build() {
String_bldr sb = String_bldr_.new_();
int comp_max = 0, path_max =0, name_max = 0;
int len = results.Count();
int len = results.Len();
for (int i = 0; i < len; i++) {
Tst_itm itm = (Tst_itm)results.Get_at(i);
comp_max = Max(comp_max, itm.Comp());

View File

@@ -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.threads; 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.threads; import gplx.*;
import gplx.core.primitives.*;
public class Gfo_async_mgr implements Gfo_invk {
private List_adp queue = List_adp_.New();
@@ -36,7 +36,7 @@ public class Gfo_async_mgr implements Gfo_invk {
try {
while (true) {
synchronized (queue) {
if (queue.Count() == 0) break;
if (queue.Len() == 0) break;
cmd = (Gfo_async_cmd_itm)List_adp_.Pop(queue);
cmd.Exec();
}

View File

@@ -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.core.threads; import gplx.*; import gplx.core.*;
package gplx.core.threads; import gplx.*;
import gplx.core.brys.fmtrs.*;
import gplx.gfui.*; import gplx.gfui.kits.core.*;
import gplx.gfui.kits.core.*;
public class Gfo_thread_cmd_replace implements Gfo_thread_cmd {
public Gfo_thread_cmd Init(Gfo_usr_dlg usr_dlg, Gfui_kit kit, Io_url fil) {
this.usr_dlg = usr_dlg; this.kit = kit; this.fil = fil;
@@ -38,7 +38,7 @@ public class Gfo_thread_cmd_replace implements Gfo_thread_cmd {
public void Async_run() {Exec_find_replace();} // NOTE: do not run async; if multiple commands for same file then they will not always work
public void Exec_find_replace() {
String raw = Io_mgr.Instance.LoadFilStr(fil);
int pairs_len = pairs.Count();
int pairs_len = pairs.Len();
for (int i = 0; i < pairs_len; i++) {
Keyval kv = (Keyval)pairs.Get_at(i);
raw = String_.Replace(raw, kv.Key(), kv.Val_to_str_or_null());

View File

@@ -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 Gfo_thread_grp implements Gfo_invk {
private final Object thread_lock = new Object();
private final List_adp list = List_adp_.New();
@@ -24,7 +24,7 @@ public class Gfo_thread_grp implements Gfo_invk {
public int Active_max() {return active_max;} public Gfo_thread_grp Active_max_(int v) {active_max = v; return this;} private int active_max = 1;
public void Add(Gfo_thread_itm... ary) {
synchronized (thread_lock) {
list.Add_many((Object[])ary);
list.AddMany((Object[])ary);
}
if (autorun)
this.Run();

View File

@@ -13,11 +13,11 @@ 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 Gfo_thread_mgr {
private final Ordered_hash hash = Ordered_hash_.New();
public Gfo_thread_grp Get_by_or_new(String k) {
Gfo_thread_grp rv = (Gfo_thread_grp)hash.Get_by(k);
Gfo_thread_grp rv = (Gfo_thread_grp)hash.GetByOrNull(k);
if (rv == null) {
rv = new Gfo_thread_grp(k);
hash.Add(k, rv);

View File

@@ -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.threads; 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.threads; import gplx.*;
public class Gfo_thread_pool implements Gfo_invk {
private Object thread_lock = new Object();
private List_adp queue = List_adp_.New();
@@ -35,7 +35,7 @@ public class Gfo_thread_pool implements Gfo_invk {
Gfo_thread_wkr wkr = null;
synchronized (thread_lock) {
if (running) return; // already running; discard run request and rely on running-wkr to call Run when done
int len = queue.Count(); if (len == 0) return; // nothing in list; occurs when last item calls Run when done
int len = queue.Len(); if (len == 0) return; // nothing in list; occurs when last item calls Run when done
running = true;
wkr = (Gfo_thread_wkr)List_adp_.Pop_first(queue);
}

View File

@@ -1,22 +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.dbs.bulks; import gplx.*; import gplx.dbs.*;
import gplx.dbs.metas.*;
public class Db_bulk_exec_ {
public static void Insert(Db_bulk_prog prog_wkr, String msg, Dbmeta_fld_itm[] flds, Db_rdr src, Db_stmt trg, Db_conn trg_conn) {
public static void Insert(Db_bulk_prog prog_wkr, String msg, DbmetaFldItm[] flds, Db_rdr src, Db_stmt trg, Db_conn trg_conn) {
// init
int flds_len = flds.length;
String[] fld_names = Db_bulk_exec_utl_.To_fld_names(flds, flds_len);
@@ -33,14 +32,14 @@ public class Db_bulk_exec_ {
for (int i = 0; i < flds_len; ++i) {
String fld_name = fld_names[i];
switch (fld_types[i]) {
case Dbmeta_fld_tid.Tid__bool : trg.Val_bool_as_byte (fld_name, src.Read_bool_by_byte (fld_name)); row_size += 1; break;
case Dbmeta_fld_tid.Tid__byte : trg.Val_byte (fld_name, src.Read_byte (fld_name)); row_size += 1; break;
case Dbmeta_fld_tid.Tid__int : trg.Val_int (fld_name, src.Read_int (fld_name)); row_size += 4; break;
case Dbmeta_fld_tid.Tid__long : trg.Val_long (fld_name, src.Read_long (fld_name)); row_size += 8; break;
case Dbmeta_fld_tid.Tid__float : trg.Val_float (fld_name, src.Read_float (fld_name)); row_size += 4; break;
case Dbmeta_fld_tid.Tid__double : trg.Val_double (fld_name, src.Read_double (fld_name)); row_size += 8; break;
case Dbmeta_fld_tid.Tid__str : String src_str = src.Read_str(fld_name); trg.Val_str(fld_name, src_str); row_size += src_str == null ? 0 : String_.Len(src_str); break;
case Dbmeta_fld_tid.Tid__bry : byte[] src_bry = src.Read_bry(fld_name); trg.Val_bry(fld_name, src_bry); row_size += src_bry == null ? 0 : src_bry.length; break;
case DbmetaFldType.TidBool: trg.Val_bool_as_byte (fld_name, src.Read_bool_by_byte (fld_name)); row_size += 1; break;
case DbmetaFldType.TidByte: trg.Val_byte (fld_name, src.Read_byte (fld_name)); row_size += 1; break;
case DbmetaFldType.TidInt: trg.Val_int (fld_name, src.Read_int (fld_name)); row_size += 4; break;
case DbmetaFldType.TidLong: trg.Val_long (fld_name, src.Read_long (fld_name)); row_size += 8; break;
case DbmetaFldType.TidFloat: trg.Val_float (fld_name, src.Read_float (fld_name)); row_size += 4; break;
case DbmetaFldType.TidDouble: trg.Val_double (fld_name, src.Read_double (fld_name)); row_size += 8; break;
case DbmetaFldType.TidStr: String src_str = src.Read_str(fld_name); trg.Val_str(fld_name, src_str); row_size += src_str == null ? 0 : String_.Len(src_str); break;
case DbmetaFldType.TidBry: byte[] src_bry = src.Read_bry(fld_name); trg.Val_bry(fld_name, src_bry); row_size += src_bry == null ? 0 : src_bry.length; break;
default : throw Err_.new_unhandled_default(fld_types[i]);
}
}
@@ -61,16 +60,16 @@ public class Db_bulk_exec_ {
public static final String Invk__bulk_insert_err = "bulk.insert.err", Invk__bulk_insert_prog = "bulk.insert.prog";
}
class Db_bulk_exec_utl_ {
public static String[] To_fld_names(Dbmeta_fld_itm[] flds, int flds_len) {
public static String[] To_fld_names(DbmetaFldItm[] flds, int flds_len) {
String[] rv = new String[flds_len];
for (int i = 0; i < flds_len; ++i)
rv[i] = flds[i].Name();
return rv;
}
public static int[] To_fld_types(Dbmeta_fld_itm[] flds, int flds_len) {
public static int[] To_fld_types(DbmetaFldItm[] flds, int flds_len) {
int[] rv = new int[flds_len];
for (int i = 0; i < flds_len; ++i)
rv[i] = flds[i].Type().Tid_ansi();
rv[i] = flds[i].Type().Tid();
return rv;
}
public static Err New_err(Exception e, Db_rdr rdr, int flds_len, String[] fld_names, int[] fld_types) {

View File

@@ -14,7 +14,7 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.dbs.bulks; import gplx.*; import gplx.dbs.*;
import gplx.dbs.*; import gplx.dbs.metas.*;
import gplx.dbs.metas.*;
public class Db_tbl_copy {
private final Bry_bfr bfr = Bry_bfr_.New();
private final Db_attach_mgr attach_mgr = new Db_attach_mgr();
@@ -36,14 +36,14 @@ public class Db_tbl_copy {
bfr.Add_str_a7("INSERT INTO ").Add_str_a7(trg_tbl).Add_byte_nl();
bfr.Add_byte(Byte_ascii.Paren_bgn);
for (int i = 0; i < flds_len; ++i) {
Dbmeta_fld_itm fld = flds.Get_at(i);
DbmetaFldItm fld = flds.Get_at(i);
if (i != 0) bfr.Add_str_a7(", ");
bfr.Add_str_a7(fld.Name());
}
bfr.Add_byte(Byte_ascii.Paren_end).Add_byte_nl();
bfr.Add_str_a7("SELECT").Add_byte_nl().Add_byte_space();
for (int i = 0; i < flds_len; ++i) {
Dbmeta_fld_itm fld = flds.Get_at(i);
DbmetaFldItm fld = flds.Get_at(i);
if (i != 0) bfr.Add_str_a7(", ");
bfr.Add_str_a7(fld.Name());
}

View File

@@ -14,11 +14,11 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.dbs.bulks; import gplx.*; import gplx.dbs.*;
import org.junit.*; import gplx.core.tests.*; import gplx.dbs.metas.*;
import org.junit.*; import gplx.core.tests.*;
public class Db_tbl_copy_tst {
private final Db_tbl_copy_fxt fxt = new Db_tbl_copy_fxt();
@Test public void Basic() {
fxt.Test__bld_sql(fxt.Make_tbl("tbl_1", Dbmeta_fld_itm.new_int("fld_1"), Dbmeta_fld_itm.new_int("fld_2")),
fxt.Test__bld_sql(fxt.Make_tbl("tbl_1", DbmetaFldItm.NewInt("fld_1"), DbmetaFldItm.NewInt("fld_2")),
String_.Concat_lines_nl_skip_last
( "INSERT INTO trg"
, "(fld_1, fld_2)"
@@ -30,7 +30,7 @@ public class Db_tbl_copy_tst {
}
class Db_tbl_copy_fxt {
private final Db_tbl_copy mgr = new Db_tbl_copy();
public Dbmeta_tbl_itm Make_tbl(String name, Dbmeta_fld_itm... flds) {return Dbmeta_tbl_itm.New(name, flds);}
public Dbmeta_tbl_itm Make_tbl(String name, DbmetaFldItm... flds) {return Dbmeta_tbl_itm.New(name, flds);}
public void Test__bld_sql(Dbmeta_tbl_itm tbl, String expd) {
Gftest.Eq__ary__lines(expd, mgr.Bld_sql(tbl, "src", "trg"), "sql");
}

View File

@@ -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.dbs.cfgs; import gplx.*; import gplx.dbs.*;
package gplx.dbs.cfgs; import gplx.*;
public class Db_cfg_hash {
private final String grp; private final Ordered_hash hash = Ordered_hash_.New();
public Db_cfg_hash(String grp) {this.grp = grp;}
public int Len() {return hash.Count();}
public int Len() {return hash.Len();}
public Db_cfg_itm Get_at(int i) {return (Db_cfg_itm)hash.Get_at(i);}
public Db_cfg_itm Get_by(String key) {
Db_cfg_itm rv = (Db_cfg_itm)hash.Get_by(key);
Db_cfg_itm rv = (Db_cfg_itm)hash.GetByOrNull(key);
return rv == null ? Db_cfg_itm.Empty : rv;
}
public void Set(String key, String val) {hash.Del(key); Add(key, val);}

View File

@@ -14,17 +14,16 @@ 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.dbs.cfgs; import gplx.*; import gplx.dbs.*;
import gplx.core.primitives.*;
public class Db_cfg_tbl implements Db_tbl {
private final String tbl_name; private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final String tbl_name; private final DbmetaFldList flds = new DbmetaFldList();
private final String fld_grp, fld_key, fld_val;
private Db_stmt stmt_insert, stmt_update, stmt_select;
public Db_conn Conn() {return conn;} private final Db_conn conn;
public Db_cfg_tbl(Db_conn conn, String tbl_name) {
this.conn = conn; this.tbl_name = tbl_name;
this.fld_grp = flds.Add_str("cfg_grp", 255);
this.fld_key = flds.Add_str("cfg_key", 255);
this.fld_val = flds.Add_str("cfg_val", 1024);
this.fld_grp = flds.AddStr("cfg_grp", 255);
this.fld_key = flds.AddStr("cfg_key", 255);
this.fld_val = flds.AddStr("cfg_val", 1024);
conn.Rls_reg(this);
}
public void Rls() {
@@ -36,7 +35,7 @@ public class Db_cfg_tbl implements Db_tbl {
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds, Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "main", fld_grp, fld_key, fld_val)));}
public void Delete_val(String grp, String key) {conn.Stmt_delete(tbl_name, fld_grp, fld_key).Crt_str(fld_grp, grp).Crt_str(fld_key, key).Exec_delete();}
public void Delete_grp(String grp) {conn.Stmt_delete(tbl_name, fld_grp).Crt_str(fld_grp, grp).Exec_delete();}
public void Delete_all() {conn.Stmt_delete(tbl_name, Dbmeta_fld_itm.Str_ary_empty).Exec_delete();}
public void Delete_all() {conn.Stmt_delete(tbl_name, DbmetaFldItm.StrAryEmpty).Exec_delete();}
public void Insert_yn (String grp, String key, boolean val) {Insert_str(grp, key, val ? "y" : "n");}
public void Insert_byte (String grp, String key, byte val) {Insert_str(grp, key, Byte_.To_str(val));}
public void Insert_int (String grp, String key, int val) {Insert_str(grp, key, Int_.To_str(val));}

View File

@@ -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.dbs.metas.updates; import gplx.*; import gplx.dbs.*; import gplx.dbs.metas.*;
public class Schema_update_mgr {
private List_adp cmds = List_adp_.New();
public void Add(Schema_update_cmd cmd) {cmds.Add(cmd);}
public void Update(Schema_db_mgr schema_mgr, Db_conn conn) {
int cmds_len = cmds.Count();
for (int i = 0; i < cmds_len; ++i) {
Schema_update_cmd cmd = (Schema_update_cmd)cmds.Get_at(i);
try {cmd.Exec(schema_mgr, conn);}
catch (Exception e) {
Gfo_usr_dlg_.Instance.Warn_many("", "", "failed to run update cmd; name=~{0} err=~{1}", cmd.Name(), Err_.Message_gplx_full(e));
}
}
}
}
package gplx.dbs.metas.updates; import gplx.*; import gplx.dbs.*; import gplx.dbs.metas.*;
public class Schema_update_mgr {
private List_adp cmds = List_adp_.New();
public void Add(Schema_update_cmd cmd) {cmds.Add(cmd);}
public void Update(Schema_db_mgr schema_mgr, Db_conn conn) {
int cmds_len = cmds.Len();
for (int i = 0; i < cmds_len; ++i) {
Schema_update_cmd cmd = (Schema_update_cmd)cmds.Get_at(i);
try {cmd.Exec(schema_mgr, conn);}
catch (Exception e) {
Gfo_usr_dlg_.Instance.Warn_many("", "", "failed to run update cmd; name=~{0} err=~{1}", cmd.Name(), Err_.Message_gplx_full(e));
}
}
}
}

View File

@@ -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.dbs.percentiles; import gplx.*; import gplx.dbs.*;
package gplx.dbs.percentiles; import gplx.*;
class Log_tbl_fmtr {
private final Bry_bfr bfr = Bry_bfr_.New();
private final List_adp itms = List_adp_.New();
@@ -22,7 +22,7 @@ class Log_tbl_fmtr {
public Log_tbl_fmtr Add_int(String key, int bgn, int end) {ary = null; itms.Add(new Log_fld_itm__int(Type_ids_.Id__int, key, bgn, end)); return this;}
public void Log(Object... vals) {
if (ary == null)
ary = (Log_fld_itm[])itms.To_ary_and_clear(Log_fld_itm.class);
ary = (Log_fld_itm[])itms.ToAryAndClear(Log_fld_itm.class);
int len = ary.length;
for (int i = 0; i < len; ++i) {
Log_fld_itm itm = ary[i];

View File

@@ -24,15 +24,15 @@ public class Fsd_bin_tbl implements Rls_able {
private final Bool_obj_ref saved_in_parts = Bool_obj_ref.n_();
public Fsd_bin_tbl(Db_conn conn, boolean schema_is_1) {
this.conn = conn;
fld__owner_id = flds.Add_int_pkey ("bin_owner_id");
fld__owner_tid = flds.Add_byte ("bin_owner_tid");
fld__part_id = flds.Add_int ("bin_part_id");
fld__data_url = flds.Add_str ("bin_data_url", 255); // for items which are > 2 GB, just store it on disc, with a path to it; EX: 120 GB file
fld__data = flds.Add_bry ("bin_data"); // mediumblob
fld__owner_id = flds.AddIntPkey("bin_owner_id");
fld__owner_tid = flds.AddByte("bin_owner_tid");
fld__part_id = flds.AddInt("bin_part_id");
fld__data_url = flds.AddStr("bin_data_url", 255); // for items which are > 2 GB, just store it on disc, with a path to it; EX: 120 GB file
fld__data = flds.AddBry("bin_data"); // mediumblob
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name = "fsdb_bin";
public Dbmeta_fld_list Flds() {return flds;} private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
public DbmetaFldList Flds() {return flds;} private final DbmetaFldList flds = new DbmetaFldList();
public void Rls() {
stmt_insert = Db_stmt_.Rls(stmt_insert);
stmt_select = Db_stmt_.Rls(stmt_select);

View File

@@ -13,17 +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.fsdb.data; import gplx.*; import gplx.fsdb.*;
package gplx.fsdb.data;
import gplx.dbs.*;
public class Fsd_dir_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld_id, fld_owner_id, fld_name;
private final Db_conn conn; private Db_stmt stmt_select_by_name;
public Fsd_dir_tbl(Db_conn conn, boolean schema_is_1) {
this.conn = conn;
this.fld_id = flds.Add_int_pkey ("dir_id");
this.fld_owner_id = flds.Add_int ("dir_owner_id");
this.fld_name = flds.Add_str ("dir_name", 255);
this.fld_id = flds.AddIntPkey("dir_id");
this.fld_owner_id = flds.AddInt("dir_owner_id");
this.fld_name = flds.AddStr("dir_name", 255);
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name = "fsdb_dir";

View File

@@ -13,24 +13,24 @@ 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.fsdb.data; import gplx.*; import gplx.fsdb.*;
import gplx.dbs.*; import gplx.dbs.qrys.*; import gplx.dbs.engines.sqlite.*;
package gplx.fsdb.data; import gplx.*;
import gplx.dbs.*; import gplx.dbs.qrys.*;
public class Fsd_fil_tbl implements Db_tbl {
public final Dbmeta_fld_list flds = new Dbmeta_fld_list();
public final DbmetaFldList flds = new DbmetaFldList();
public final String fld_id, fld_owner_id, fld_name, fld_xtn_id, fld_ext_id, fld_size, fld_modified, fld_hash, fld_bin_db_id;
private final String idx_owner;
public final Db_conn conn; private Db_stmt stmt_insert, stmt_update, stmt_select_by_name; private int mnt_id;
public Fsd_fil_tbl(Db_conn conn, boolean schema_is_1, int mnt_id) {
this.conn = conn; this.mnt_id = mnt_id;
this.fld_id = flds.Add_int_pkey ("fil_id");
this.fld_owner_id = flds.Add_int ("fil_owner_id");
this.fld_xtn_id = flds.Add_int ("fil_xtn_id");
this.fld_ext_id = flds.Add_int ("fil_ext_id");
this.fld_bin_db_id = flds.Add_int ("fil_bin_db_id"); // group ints at beginning of table
this.fld_name = flds.Add_str ("fil_name", 255);
this.fld_size = flds.Add_long ("fil_size");
this.fld_modified = flds.Add_str ("fil_modified", 14); // stored as yyyyMMddHHmmss
this.fld_hash = flds.Add_str ("fil_hash", 40);
this.fld_id = flds.AddIntPkey("fil_id");
this.fld_owner_id = flds.AddInt("fil_owner_id");
this.fld_xtn_id = flds.AddInt("fil_xtn_id");
this.fld_ext_id = flds.AddInt("fil_ext_id");
this.fld_bin_db_id = flds.AddInt("fil_bin_db_id"); // group ints at beginning of table
this.fld_name = flds.AddStr("fil_name", 255);
this.fld_size = flds.AddLong("fil_size");
this.fld_modified = flds.AddStr("fil_modified", 14); // stored as yyyyMMddHHmmss
this.fld_hash = flds.AddStr("fil_hash", 40);
this.idx_owner = Dbmeta_idx_itm.Bld_idx_name(tbl_name, "owner");
conn.Rls_reg(this);
}
@@ -78,7 +78,7 @@ public class Fsd_fil_tbl implements Db_tbl {
}
public Fsd_fil_itm Select_or_null(int dir_id, byte[] fil_name) {
if (stmt_select_by_name == null) {
Db_qry__select_cmd qry = new Db_qry__select_cmd().From_(tbl_name).Cols_(flds.To_str_ary()).Where_(Db_crt_.eq_many_(fld_owner_id, fld_name)).Indexed_by_(idx_owner);
Db_qry__select_cmd qry = new Db_qry__select_cmd().From_(tbl_name).Cols_(flds.ToStrAry()).Where_(Db_crt_.eq_many_(fld_owner_id, fld_name)).Indexed_by_(idx_owner);
stmt_select_by_name = conn.Stmt_new(qry);
}
Db_rdr rdr = stmt_select_by_name.Clear()
@@ -91,7 +91,7 @@ public class Fsd_fil_tbl implements Db_tbl {
finally {rdr.Rls();}
}
public void Select_all(Bry_bfr key_bfr, gplx.core.caches.Gfo_cache_mgr_bry cache) {
Db_rdr rdr = conn.Stmt_select(tbl_name, flds, Dbmeta_fld_itm.Str_ary_empty).Exec_select__rls_auto();
Db_rdr rdr = conn.Stmt_select(tbl_name, flds, DbmetaFldItm.StrAryEmpty).Exec_select__rls_auto();
try {
while (rdr.Move_next()) {
Fsd_fil_itm fil = New_by_rdr(mnt_id, rdr);

View File

@@ -13,31 +13,32 @@ 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.fsdb.data; import gplx.*; import gplx.fsdb.*;
import gplx.dbs.*; import gplx.fsdb.meta.*; import gplx.xowa.files.*;
package gplx.fsdb.data; import gplx.*;
import gplx.dbs.*;
import gplx.xowa.files.*;
public class Fsd_thm_tbl implements Db_tbl {
public final Dbmeta_fld_list flds = new Dbmeta_fld_list();
public final DbmetaFldList flds = new DbmetaFldList();
public final String fld_id, fld_owner_id, fld_w, fld_h, fld_time, fld_page, fld_bin_db_id, fld_size, fld_modified, fld_hash;
public final Db_conn conn; private Db_stmt stmt_insert, stmt_select_by_fil_exact, stmt_select_by_fil_near; private int mnt_id; private boolean schema_thm_page;
public Fsd_thm_tbl(Db_conn conn, boolean schema_is_1, int mnt_id, boolean schema_thm_page) {
this.conn = conn; this.mnt_id = mnt_id; this.schema_thm_page = schema_thm_page;
this.tbl_name = schema_is_1 ? "fsdb_xtn_thm" : "fsdb_thm";
this.fld_id = flds.Add_int_pkey ("thm_id");
this.fld_owner_id = flds.Add_int ("thm_owner_id");
this.fld_w = flds.Add_int ("thm_w");
this.fld_h = flds.Add_int ("thm_h");
this.fld_id = flds.AddIntPkey("thm_id");
this.fld_owner_id = flds.AddInt("thm_owner_id");
this.fld_w = flds.AddInt("thm_w");
this.fld_h = flds.AddInt("thm_h");
if (schema_thm_page) {
this.fld_time = flds.Add_double ("thm_time");
this.fld_page = flds.Add_int ("thm_page");
this.fld_time = flds.AddDouble("thm_time");
this.fld_page = flds.AddInt("thm_page");
}
else {
this.fld_time = flds.Add_int ("thm_thumbtime");
this.fld_page = Dbmeta_fld_itm.Key_null;
this.fld_time = flds.AddInt("thm_thumbtime");
this.fld_page = DbmetaFldItm.KeyNull;
}
this.fld_bin_db_id = flds.Add_int ("thm_bin_db_id");
this.fld_size = flds.Add_long ("thm_size");
this.fld_modified = flds.Add_str ("thm_modified", 14); // stored as yyyyMMddHHmmss
this.fld_hash = flds.Add_str ("thm_hash", 40);
this.fld_bin_db_id = flds.AddInt("thm_bin_db_id");
this.fld_size = flds.AddLong("thm_size");
this.fld_modified = flds.AddStr("thm_modified", 14); // stored as yyyyMMddHHmmss
this.fld_hash = flds.AddStr("thm_hash", 40);
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;
@@ -126,8 +127,8 @@ public class Fsd_thm_tbl implements Db_tbl {
public static final DateAdp Modified_null = null;
public static final String Hash_null = "", Modified_null_str = "";
public static boolean Match_nearest(List_adp list, Fsd_thm_itm thm, boolean schema_thm_page) {
int len = list.Count(); if (len == 0) return Bool_.N;
list.Sort_by(Fsdb_thm_itm_sorter.Instance);
int len = list.Len(); if (len == 0) return Bool_.N;
list.SortBy(Fsdb_thm_itm_sorter.Instance);
int thm_w = thm.W(), thm_page = thm.Page(); double thm_time = thm.Time();
Fsd_thm_itm max = null;
for (int i = 0; i < len; ++i) {

View File

@@ -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.fsdb.data; import gplx.*; import gplx.fsdb.*;
package gplx.fsdb.data; import gplx.*;
import org.junit.*;
public class Fsd_thm_tbl_tst {
@Before public void init() {fxt.Clear();} private Fsd_thm_tbl_fxt fxt = new Fsd_thm_tbl_fxt();
@@ -41,7 +41,7 @@ class Fsd_thm_tbl_fxt {
rv.Init_by_req(w, time, page);
return rv;
}
public void Init_list(Fsd_thm_itm... ary) {list.Add_many((Object[])ary);}
public void Init_list(Fsd_thm_itm... ary) {list.AddMany((Object[])ary);}
public void Test_match_nearest_itm(Fsd_thm_itm req, Fsd_thm_itm expd) {
Fsd_thm_tbl.Match_nearest(list, req, Bool_.Y);
if (expd == Fsd_thm_itm.Null) {

View File

@@ -14,9 +14,9 @@ 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.fsdb.meta; import gplx.*; import gplx.fsdb.*;
import gplx.dbs.*; import gplx.dbs.qrys.*;
import gplx.dbs.*;
public class Fsm_atr_tbl implements Db_tbl {
public final Dbmeta_fld_list flds = new Dbmeta_fld_list();
public final DbmetaFldList flds = new DbmetaFldList();
private final String fld_uid, fld_url;
private final Db_conn conn;
public Fsm_atr_tbl(Db_conn conn, boolean schema_is_1) {
@@ -24,13 +24,13 @@ public class Fsm_atr_tbl implements Db_tbl {
String fld_prefix = "";
if (schema_is_1) {tbl_name = "fsdb_db_atr";}
else {tbl_name = "fsdb_dba"; fld_prefix = "dba_";}
this.fld_uid = flds.Add_int_pkey (fld_prefix + "uid");
this.fld_url = flds.Add_str (fld_prefix + "url", 255);
this.fld_uid = flds.AddIntPkey(fld_prefix + "uid");
this.fld_url = flds.AddStr(fld_prefix + "url", 255);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds));}
public Fsm_atr_fil Select_1st_or_fail(Fsm_mnt_itm mnt_itm, Fsdb_db_mgr core_mgr, int mnt_id, boolean schema_thm_page) {
Db_rdr rdr = conn.Stmt_select(tbl_name, flds, Dbmeta_fld_itm.Str_ary_empty).Exec_select__rls_auto();
Db_rdr rdr = conn.Stmt_select(tbl_name, flds, DbmetaFldItm.StrAryEmpty).Exec_select__rls_auto();
boolean schema_is_1 = core_mgr.File__schema_is_1();
try {
if (rdr.Move_next()) {

View File

@@ -14,7 +14,7 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.fsdb.meta; import gplx.*; import gplx.fsdb.*;
import gplx.core.ios.*; import gplx.core.ios.streams.*; import gplx.dbs.*;
import gplx.core.ios.streams.*; import gplx.dbs.*;
public class Fsm_bin_mgr {
private final Fsdb_db_mgr core_mgr; private final int mnt_id; private final Fsm_bin_tbl tbl;
private final Ordered_hash db_hash = Ordered_hash_.New();
@@ -35,7 +35,7 @@ public class Fsm_bin_mgr {
public int Dbs__len() {return db_hash.Len();}
public Fsm_bin_fil Dbs__get_nth() {return nth_db;}
public Fsm_bin_fil Dbs__get_at(int i) {return (Fsm_bin_fil)db_hash.Get_at(i);}
public Fsm_bin_fil Dbs__get_by_or_null(int i) {return (Fsm_bin_fil)db_hash.Get_by(i);}
public Fsm_bin_fil Dbs__get_by_or_null(int i) {return (Fsm_bin_fil)db_hash.GetByOrNull(i);}
public Fsm_bin_fil Dbs__make(String file_name) {return Dbs__make(db_hash.Len(), file_name);}
public Fsm_bin_fil Dbs__make(int id, String file_name) {
Fsdb_db_file db = core_mgr.File__bin_file__new(mnt_id, file_name);
@@ -46,7 +46,7 @@ public class Fsm_bin_mgr {
return rv;
}
public void Insert(int db_id, int bin_id, byte owner_tid, long bin_len, Io_stream_rdr bin_rdr) {
Fsm_bin_fil fil = (Fsm_bin_fil)db_hash.Get_by(db_id);
Fsm_bin_fil fil = (Fsm_bin_fil)db_hash.GetByOrNull(db_id);
fil.Insert(bin_id, owner_tid, bin_len, bin_rdr);
fil.Insert(bin_id, owner_tid, bin_len, bin_rdr);
}

View File

@@ -14,9 +14,9 @@ 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.fsdb.meta; import gplx.*; import gplx.fsdb.*;
import gplx.dbs.*; import gplx.dbs.qrys.*;
import gplx.dbs.*;
public class Fsm_bin_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld_uid, fld_url, fld_bin_len, fld_bin_max;
private final Db_conn conn; private int mnt_id;
public Fsm_bin_tbl(Db_conn conn, boolean schema_is_1, int mnt_id) {
@@ -24,15 +24,15 @@ public class Fsm_bin_tbl implements Db_tbl {
String fld_prefix = "";
if (schema_is_1) {tbl_name = "fsdb_db_bin";}
else {tbl_name = "fsdb_dbb"; fld_prefix = "dbb_";}
fld_uid = flds.Add_int_pkey (fld_prefix + "uid");
fld_url = flds.Add_str (fld_prefix + "url", 255);
fld_uid = flds.AddIntPkey(fld_prefix + "uid");
fld_url = flds.AddStr(fld_prefix + "url", 255);
if (schema_is_1) {
fld_bin_len = flds.Add_long("bin_len");
fld_bin_max = flds.Add_long("bin_max");
fld_bin_len = flds.AddLong("bin_len");
fld_bin_max = flds.AddLong("bin_max");
}
else {
fld_bin_len = Dbmeta_fld_itm.Key_null;
fld_bin_max = Dbmeta_fld_itm.Key_null;
fld_bin_len = DbmetaFldItm.KeyNull;
fld_bin_max = DbmetaFldItm.KeyNull;
}
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;
@@ -42,7 +42,7 @@ public class Fsm_bin_tbl implements Db_tbl {
}
public Fsm_bin_fil[] Select_all(Fsdb_db_mgr db_conn_mgr) {
List_adp rv = List_adp_.New();
Db_rdr rdr = conn.Stmt_select_order(tbl_name, flds, Dbmeta_fld_itm.Str_ary_empty, fld_uid).Clear().Exec_select__rls_auto();
Db_rdr rdr = conn.Stmt_select_order(tbl_name, flds, DbmetaFldItm.StrAryEmpty, fld_uid).Clear().Exec_select__rls_auto();
try {
while (rdr.Move_next()) {
int bin_id = rdr.Read_int(fld_uid);
@@ -52,7 +52,7 @@ public class Fsm_bin_tbl implements Db_tbl {
rv.Add(itm);
}
} finally {rdr.Rls();}
return (Fsm_bin_fil[])rv.To_ary(Fsm_bin_fil.class);
return (Fsm_bin_fil[])rv.ToAry(Fsm_bin_fil.class);
}
public void Rls() {}
}

View File

@@ -14,7 +14,7 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.fsdb.meta; import gplx.*; import gplx.fsdb.*;
import gplx.dbs.*; import gplx.dbs.cfgs.*; import gplx.fsdb.meta.*;
import gplx.dbs.*; import gplx.dbs.cfgs.*;
public class Fsm_cfg_mgr {
private final Db_cfg_tbl tbl; private final Hash_adp grp_hash = Hash_adp_.New();
public Fsm_cfg_mgr(Fsdb_db_mgr db_conn_mgr, Db_conn conn) {
@@ -40,7 +40,7 @@ public class Fsm_cfg_mgr {
public boolean Patch__page_gt_1() {return patch__page_gt_1;} private boolean patch__page_gt_1 = false;
public void Patch__save(String cfg_key) {tbl.Insert_yn(Fsm_cfg_mgr.Grp_core, cfg_key, Bool_.Y);}
public Db_cfg_hash Grps_get_or_load(String grp_key) {
Db_cfg_hash rv = (Db_cfg_hash)grp_hash.Get_by(grp_key);
Db_cfg_hash rv = (Db_cfg_hash)grp_hash.GetByOrNull(grp_key);
if (rv == null) {
rv = tbl.Select_as_hash(grp_key);
grp_hash.Add(grp_key, rv);

View File

@@ -13,17 +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.fsdb.meta; import gplx.*; import gplx.fsdb.*;
package gplx.fsdb.meta; import gplx.*;
import gplx.dbs.*;
public class Fsm_mnt_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld_id, fld_name, fld_url;
private final Db_conn conn;
public Fsm_mnt_tbl(Db_conn conn, boolean schema_is_1) {
this.conn = conn;
fld_id = flds.Add_int_pkey ("mnt_id");
fld_name = flds.Add_str ("mnt_name", 255);
fld_url = flds.Add_str ("mnt_url", 255);
fld_id = flds.AddIntPkey("mnt_id");
fld_name = flds.AddStr("mnt_name", 255);
fld_url = flds.AddStr("mnt_url", 255);
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name = "fsdb_mnt";
@@ -44,7 +44,7 @@ public class Fsm_mnt_tbl implements Db_tbl {
}
public Fsm_mnt_itm[] Select_all() {
List_adp list = List_adp_.New();
Db_rdr rdr = conn.Stmt_select(tbl_name, flds, Dbmeta_fld_itm.Str_ary_empty).Clear().Exec_select__rls_auto();
Db_rdr rdr = conn.Stmt_select(tbl_name, flds, DbmetaFldItm.StrAryEmpty).Clear().Exec_select__rls_auto();
try {
while (rdr.Move_next()) {
Fsm_mnt_itm itm = new Fsm_mnt_itm(rdr.Read_int(fld_id), rdr.Read_str(fld_name), rdr.Read_str(fld_url));
@@ -52,7 +52,7 @@ public class Fsm_mnt_tbl implements Db_tbl {
}
}
finally {rdr.Rls();}
return (Fsm_mnt_itm[])list.To_ary_and_clear(Fsm_mnt_itm.class);
return (Fsm_mnt_itm[])list.ToAryAndClear(Fsm_mnt_itm.class);
}
public static final String Mnt_name_main = "fsdb.main", Mnt_name_user = "fsdb.user";
}

View File

@@ -88,7 +88,7 @@ public class Gfui_bnd_parser {
++pos;
itm_bgn = itm_end = -1;
}
int tkns_len = tkns.Count();
int tkns_len = tkns.Len();
for (int i = 0; i < tkns_len; i++) {
Gfui_bnd_tkn tkn = (Gfui_bnd_tkn)tkns.Get_at(i);
tkn.Write(tmp_bfr, !src_is_gfui);
@@ -267,7 +267,7 @@ public class Gfui_bnd_parser {
byte[] norm_bry = Bry_.new_u8(norm);
Gfui_bnd_tkn itm = new Gfui_bnd_tkn(tid, Gfui_bnd_tkn.Keycode_null, gfui_bry, norm_bry);
gfui_regy.Add(gfui_bry, itm);
norm_regy.Add_if_dupe_use_1st(norm_bry, itm);
norm_regy.AddIfDupeUse1st(norm_bry, itm);
}
private static final int Mod_val_null = 0;
public static Gfui_bnd_parser new_en_() {return new Gfui_bnd_parser().Init_en();} Gfui_bnd_parser() {}

View File

@@ -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.*;
public class Dsv_tbl_parser_int_tst {
private Dsv_mok_fxt fxt = new Dsv_mok_fxt();
@@ -36,7 +36,7 @@ class Mok_int_itm implements To_str_able {
}
class Mok_int_mgr extends Mok_mgr_base {
public void Clear() {itms.Clear();}
@Override public To_str_able[] Itms() {return (To_str_able[])itms.To_ary(To_str_able.class);} private List_adp itms = List_adp_.New();
@Override public To_str_able[] Itms() {return (To_str_able[])itms.ToAry(To_str_able.class);} private List_adp itms = List_adp_.New();
private String fld_0;
private int fld_1, fld_2;
@Override public Dsv_fld_parser[] Fld_parsers() {

View File

@@ -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.*;
public class Dsv_tbl_parser_str_tst {
private Dsv_mok_fxt fxt = new Dsv_mok_fxt();
@@ -88,7 +88,7 @@ class Mok_str_mgr extends Mok_mgr_base {
this.flds_len = flds_len;
}
public void Clear() {itms.Clear();}
@Override public To_str_able[] Itms() {return (To_str_able[])itms.To_ary(To_str_able.class);} private List_adp itms = List_adp_.New();
@Override public To_str_able[] Itms() {return (To_str_able[])itms.ToAry(To_str_able.class);} private List_adp itms = List_adp_.New();
private List_adp flds = List_adp_.New();
@Override public boolean Write_bry(Dsv_tbl_parser parser, int fld_idx, byte[] src, int bgn, int end) {
flds.Add(String_.new_u8(src, bgn, end));
@@ -101,7 +101,7 @@ class Mok_str_mgr extends Mok_mgr_base {
return rv;
}
@Override public void Commit_itm(Dsv_tbl_parser parser, int pos) {
Mok_str_itm itm = new Mok_str_itm((String[])flds.To_ary_and_clear(String.class));
Mok_str_itm itm = new Mok_str_itm((String[])flds.ToAryAndClear(String.class));
itms.Add(itm);
}
}

View File

@@ -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.gfs; import gplx.*; import gplx.langs.*;
package gplx.langs.gfs; import gplx.*;
import gplx.core.btries.*;
class Gfs_parser_ctx {
public Btrie_fast_mgr Trie() {return trie;} Btrie_fast_mgr trie;
@@ -53,10 +53,10 @@ class Gfs_parser_ctx {
cur_nde.Atrs_add(nde);
return nde;
}
public void Cur_nde_from_stack() {cur_nde = (Gfs_nde)nodes.Get_at_last();}
public void Cur_nde_from_stack() {cur_nde = (Gfs_nde)nodes.GetAtLast();}
public void Stack_add() {nodes.Add(cur_nde);} List_adp nodes = List_adp_.New();
public void Stack_pop(int pos) {
if (nodes.Count() < 2) err_mgr.Fail_nde_stack_empty(this, pos); // NOTE: need at least 2 items; 1 to pop and 1 to set as current
if (nodes.Len() < 2) err_mgr.Fail_nde_stack_empty(this, pos); // NOTE: need at least 2 items; 1 to pop and 1 to set as current
List_adp_.Del_at_last(nodes);
Cur_nde_from_stack();
}

View File

@@ -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.htmls; import gplx.*; import gplx.langs.*;
package gplx.langs.htmls; import gplx.*;
import gplx.core.brys.*;
public class Gfh_parser {
public Gfh_parser() {
@@ -51,7 +51,7 @@ public class Gfh_parser {
break;
}
}
return (Gfh_nde[])rv.To_ary(Gfh_nde.class);
return (Gfh_nde[])rv.ToAry(Gfh_nde.class);
}
int cur_lhs_bgn, cur_lhs_end, cur_name_bgn, cur_name_end, cur_rhs_bgn; boolean xnde_init = true, tag_tid_is_inline = false;
private boolean Parse_xnde_rhs() {

View File

@@ -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.htmls; 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.htmls; import gplx.*;
public class Gfh_selecter {
public static Gfh_nde[] Select(byte[] src, Gfh_nde[] ary, Hash_adp_bry hash) {
List_adp list = List_adp_.New();
@@ -31,7 +31,7 @@ public class Gfh_selecter {
}
}
}
Gfh_nde[] rv = (Gfh_nde[])list.To_ary(Gfh_nde.class);
Gfh_nde[] rv = (Gfh_nde[])list.ToAry(Gfh_nde.class);
list.Clear();
return rv;
}

View File

@@ -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.htmls.clses; import gplx.*; import gplx.langs.*; import gplx.langs.htmls.*;
package gplx.langs.htmls.clses; import gplx.*;
import org.junit.*;
public class Gfh_class_parser__tst {
private final Gfh_class_parser__fxt fxt = new Gfh_class_parser__fxt();
@@ -37,6 +37,6 @@ class Gfh_class_wkr__list implements Gfh_class_parser_wkr {
}
public String[] Parse(byte[] src, int src_bgn, int src_end) {
Gfh_class_parser_.Parse(src, src_bgn, src_end, this);
return (String[])list.To_ary_and_clear(String.class);
return (String[])list.ToAryAndClear(String.class);
}
}

View File

@@ -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.langs.htmls.docs; import gplx.*; import gplx.langs.*; import gplx.langs.htmls.*;
package gplx.langs.htmls.docs; import gplx.*;
import gplx.langs.htmls.*;
import gplx.xowa.parsers.htmls.*; import gplx.langs.htmls.styles.*; import gplx.langs.htmls.clses.*;
public class Gfh_tag implements Mwh_atr_wkr {
private Gfh_tag_rdr tag_rdr;
@@ -51,21 +52,21 @@ public class Gfh_tag implements Mwh_atr_wkr {
public boolean Tag_is_tail() {return tag_is_tail;} private boolean tag_is_tail;
public boolean Tag_is_inline() {return tag_is_inline;} private boolean tag_is_inline;
public Ordered_hash Atrs__hash() {if (atrs_null) Atrs__make(); return atrs_hash;}
public int Atrs__len() {if (atrs_null) Atrs__make(); return atrs_hash.Count();}
public int Atrs__len() {if (atrs_null) Atrs__make(); return atrs_hash.Len();}
public boolean Atrs__match_pair(byte[] key, byte[] val) {
if (atrs_null) Atrs__make();
Gfh_atr rv = (Gfh_atr)atrs_hash.Get_by(key);
Gfh_atr rv = (Gfh_atr)atrs_hash.GetByOrNull(key);
return rv == null ? false : Bry_.Eq(val, rv.Val());
}
public boolean Atrs__cls_has(byte[] val) {
if (atrs_null) Atrs__make();
Gfh_atr rv = (Gfh_atr)atrs_hash.Get_by(Gfh_atr_.Bry__class); if (rv == null) return false;
Gfh_atr rv = (Gfh_atr)atrs_hash.GetByOrNull(Gfh_atr_.Bry__class); if (rv == null) return false;
byte[] rv_val = rv.Val();
return Gfh_class_.Has(rv_val, 0, rv_val.length, val);
}
public boolean Atrs__cls_eq(byte[] val) {
if (atrs_null) Atrs__make();
Gfh_atr rv = (Gfh_atr)atrs_hash.Get_by(Gfh_atr_.Bry__class); if (rv == null) return false;
Gfh_atr rv = (Gfh_atr)atrs_hash.GetByOrNull(Gfh_atr_.Bry__class); if (rv == null) return false;
return Bry_.Eq(val, rv.Val());
}
public byte Atrs__cls_find_or_fail(Hash_adp_bry hash) {
@@ -74,23 +75,23 @@ public class Gfh_tag implements Mwh_atr_wkr {
}
public byte Atrs__cls_find_or(Hash_adp_bry hash, byte or) {
if (atrs_null) Atrs__make();
Gfh_atr cls_atr = (Gfh_atr)atrs_hash.Get_by(Gfh_atr_.Bry__class); if (cls_atr == null) return or;
Gfh_atr cls_atr = (Gfh_atr)atrs_hash.GetByOrNull(Gfh_atr_.Bry__class); if (cls_atr == null) return or;
byte rv = Gfh_class_.Find_1st(src, cls_atr.Val_bgn(), cls_atr.Val_end(), hash); if (rv == Byte_.Max_value_127) return or;
return rv;
}
public int Atrs__style_get_as_int(byte[] key) {
if (atrs_null) Atrs__make();
Gfh_atr rv = (Gfh_atr)atrs_hash.Get_by(Gfh_atr_.Bry__style); if (rv == null) return -1;
Gfh_atr rv = (Gfh_atr)atrs_hash.GetByOrNull(Gfh_atr_.Bry__style); if (rv == null) return -1;
byte[] rv_val = rv.Val();
return style_wkr.Parse(rv_val, 0, rv_val.length, key);
}
public boolean Atrs__has(byte[] key) {
if (atrs_null) Atrs__make();
return atrs_hash.Get_by(key) != null;
return atrs_hash.GetByOrNull(key) != null;
}
public byte[] Atrs__get_as_bry(byte[] key) {
if (atrs_null) Atrs__make();
Gfh_atr rv = (Gfh_atr)atrs_hash.Get_by(key);
Gfh_atr rv = (Gfh_atr)atrs_hash.GetByOrNull(key);
return rv == null ? Bry_.Empty : rv.Val();
}
public int Atrs__get_as_int(byte[] key) {
@@ -99,12 +100,12 @@ public class Gfh_tag implements Mwh_atr_wkr {
}
public int Atrs__get_as_int_or(byte[] key, int or) {
if (atrs_null) Atrs__make();
Gfh_atr rv = (Gfh_atr)atrs_hash.Get_by(key); if (rv == null) return or;
Gfh_atr rv = (Gfh_atr)atrs_hash.GetByOrNull(key); if (rv == null) return or;
return Bry_.To_int_or(src, rv.Val_bgn(), rv.Val_end(), or);
}
public double Atrs__get_as_double_or(byte[] key, double or) {
if (atrs_null) Atrs__make();
Gfh_atr rv = (Gfh_atr)atrs_hash.Get_by(key); if (rv == null) return or;
Gfh_atr rv = (Gfh_atr)atrs_hash.GetByOrNull(key); if (rv == null) return or;
return Bry_.To_double_or(src, rv.Val_bgn(), rv.Val_end(), or);
}
public Gfh_atr Atrs__get_at(int i) {return (Gfh_atr)atrs_hash.Get_at(i);}
@@ -112,7 +113,7 @@ public class Gfh_tag implements Mwh_atr_wkr {
public Gfh_atr Atrs__get_by_or_empty(byte[] key) {return Atrs__get_by_or_fail(key, Bool_.N);}
public Gfh_atr Atrs__get_by_or_fail(byte[] key, boolean fail_if_null) {
if (atrs_null) Atrs__make();
Gfh_atr rv = (Gfh_atr)atrs_hash.Get_by(key);
Gfh_atr rv = (Gfh_atr)atrs_hash.GetByOrNull(key);
if (rv == null) {
if (fail_if_null) tag_rdr.Err_wkr().Fail("atr missing", "key", key);
else return Gfh_atr.Noop;
@@ -122,7 +123,7 @@ public class Gfh_tag implements Mwh_atr_wkr {
public String Atrs__print() {
if (atrs_null) Atrs__make();
Bry_bfr bfr = Bry_bfr_.New();
int len = atrs_hash.Count();
int len = atrs_hash.Len();
for (int i = 0; i < len; ++i) {
Gfh_atr atr = (Gfh_atr)atrs_hash.Get_at(i);
bfr.Add(atr.Key()).Add_byte_eq().Add(atr.Val()).Add_byte_nl();
@@ -147,7 +148,7 @@ public class Gfh_tag implements Mwh_atr_wkr {
}
else
val_bry = key_bry;
Gfh_atr atr = new Gfh_atr(atrs_hash.Count(), atr_bgn, atr_end, key_bry, val_bry, src, val_bgn, val_end);
Gfh_atr atr = new Gfh_atr(atrs_hash.Len(), atr_bgn, atr_end, key_bry, val_bry, src, val_bgn, val_end);
atrs_hash.Add(key_bry, atr);
}
public String To_str() {
@@ -157,7 +158,7 @@ public class Gfh_tag implements Mwh_atr_wkr {
}
private static Ordered_hash Copy(Ordered_hash src) {
Ordered_hash rv = Ordered_hash_.New();
int len = src.Count();
int len = src.Len();
for (int i = 0; i < len; ++i) {
Gfh_atr atr = (Gfh_atr)src.Get_at(i);
rv.Add(atr.Key(), atr);

View File

@@ -13,17 +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.langs.htmls.styles; import gplx.*; import gplx.langs.*; import gplx.langs.htmls.*;
package gplx.langs.htmls.styles; import gplx.*;
public class Gfh_style_wkr__ary implements Gfh_style_wkr {
private final List_adp list = List_adp_.New();
public boolean On_atr(byte[] src, int atr_idx, int atr_val_bgn, int atr_val_end, int itm_bgn, int itm_End, int key_bgn, int key_end, int val_bgn, int val_end) {
byte[] key = Bry_.Mid(src, key_bgn, key_end);
byte[] val = Bry_.Mid(src, val_bgn, val_end);
list.Add(new Gfh_style_itm(list.Count(), key, val));
list.Add(new Gfh_style_itm(list.Len(), key, val));
return true;
}
public Gfh_style_itm[] Parse(byte[] src, int src_bgn, int src_end) {
Gfh_style_parser_.Parse(src, src_bgn, src_end, this);
return (Gfh_style_itm[])list.To_ary_and_clear(Gfh_style_itm.class);
return (Gfh_style_itm[])list.ToAryAndClear(Gfh_style_itm.class);
}
}

View File

@@ -173,17 +173,17 @@ class Mustache_doc_itm__mock implements Mustache_doc_itm {
public Mustache_doc_itm__mock Add_bool_n(String key) {hash_bool.Add(key, Bool_obj_ref.n_()); return this;}
public Mustache_doc_itm__mock Add_subs(String key, Mustache_doc_itm__mock... ary) {hash_subs.Add(key, ary); return this;}
public boolean Mustache__write(String key, Mustache_bfr bfr) {
byte[] rv = (byte[])hash_prop.Get_by(key);
byte[] rv = (byte[])hash_prop.GetByOrNull(key);
if (rv == null) return false;
bfr.Add_bry(rv);
return true;
}
public Mustache_doc_itm[] Mustache__subs(String key) {
Object rv = hash_bool.Get_by(key);
Object rv = hash_bool.GetByOrNull(key);
if (rv != null) {
boolean bool_val = ((Bool_obj_ref)rv).Val();
return bool_val ? Mustache_doc_itm_.Ary__bool__y : Mustache_doc_itm_.Ary__bool__n;
}
return (Mustache_doc_itm__mock[])hash_subs.Get_by(key);
return (Mustache_doc_itm__mock[])hash_subs.GetByOrNull(key);
}
}

View File

@@ -1,174 +1,174 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2020 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.mustaches;
import gplx.Bry_;
import gplx.Bry_find_;
import gplx.Byte_ascii;
import gplx.Err;
import gplx.Err_;
import gplx.Io_mgr;
import gplx.Io_url;
import gplx.List_adp;
import gplx.List_adp_;
public class Mustache_tkn_parser {
private byte[] src; private int src_end;
private Io_url template_root;
private final Mustache_tkn_def tkn_def = new Mustache_tkn_def();
public Mustache_tkn_parser() {
}
public Mustache_tkn_parser(Io_url template_root) {
this.template_root = template_root;
}
public Mustache_tkn_itm Parse(String template) { return Parse(template, Bry_.Empty); }
public Mustache_tkn_itm Parse(String template, byte[] default_text) {
byte[] template_data = Io_mgr.Instance.LoadFilBryOr(template_root.GenSubFil_nest(template + ".mustache"), default_text);
return Parse(template_data, 0, template_data.length);
}
public Mustache_tkn_itm Parse(byte[] src) {return Parse(src, 0, src.length);}
public Mustache_tkn_itm Parse(byte[] src, int src_bgn, int src_end) {
this.src = src; this.src_end = src_end;
Mustache_tkn_root root = new Mustache_tkn_root();
Parse_grp(root, src_bgn);
return root;
}
private int Parse_grp(Mustache_tkn_itm owner, int src_bgn) {
List_adp subs_list = List_adp_.New();
int txt_bgn = src_bgn;
boolean end_grp = false;
while (true) {// loop for "{{"
int lhs_bgn = Bry_find_.Find_fwd(src, tkn_def.Variable_lhs, txt_bgn, src_end); // next "{{"
if (lhs_bgn == Bry_find_.Not_found) { // no more "{{"
subs_list.Add(new Mustache_tkn_text(src, txt_bgn, src_end)); // add everything between prv "}}" and cur "{{"
break;
}
int lhs_end = lhs_bgn + tkn_def.Variable_lhs_len;
Mustache_tkn_data tkn_data = new Mustache_tkn_data(src[lhs_end]); // preview tkn
lhs_end += tkn_data.lhs_end_adj;
int rhs_bgn = Bry_find_.Find_fwd(src, tkn_def.Variable_rhs, lhs_end, src_end); // next "}}"
if (rhs_bgn == Bry_find_.Not_found) throw Fail(lhs_bgn, "unclosed tag"); // fail if no "}}"
int rhs_end = rhs_bgn + tkn_def.Variable_rhs_len;
if (tkn_data.rhs_bgn_chk != Byte_ascii.Null) {
if (src[rhs_bgn] != tkn_data.rhs_bgn_chk) throw Fail(lhs_end, "invalid check byte");
++rhs_end; // skip the chk_byte; note that bottom of function will skip "}}" by adding +2
}
int txt_end = lhs_bgn; // get text tkn
if (tkn_data.ws_ignore) {
int new_txt_bgn = Trim_bwd_to_nl(src, txt_bgn, txt_end);
if (new_txt_bgn != -1) {
int new_txt_end = Trim_fwd_to_nl(src, rhs_end, src_end);
if (new_txt_end != -1) {
txt_end = new_txt_bgn;
rhs_end = new_txt_end == src_end ? src_end : new_txt_end + 1;
}
}
}
if (txt_end > txt_bgn) // ignore 0-byte text tkns; occurs when consecutive tkns; EX: {{v1}}{{v2}} will try to create text tkn between "}}{{"
subs_list.Add(new Mustache_tkn_text(src, txt_bgn, txt_end)); // add everything between prv "}}" and cur "{{"
txt_bgn = Parse_itm(tkn_data, subs_list, lhs_end, rhs_bgn, rhs_end); // do parse
if (txt_bgn < 0) { // NOTE: txt_bgn < 0 means end grp
txt_bgn *= -1;
end_grp = true;
}
if (end_grp) break;
}
if (subs_list.Count() > 0) // don't create subs if no members
owner.Subs_ary_((Mustache_tkn_itm[])subs_list.To_ary_and_clear(Mustache_tkn_itm.class));
return txt_bgn;
}
private int Parse_itm(Mustache_tkn_data tkn_data, List_adp subs_list, int lhs_end, int rhs_bgn, int rhs_end) {
byte[] val_bry = Bry_.Mid(src, lhs_end, rhs_bgn);
Mustache_tkn_base tkn = null;
switch (tkn_data.tid) {
default: throw Err_.new_unhandled(tkn_data.tid);
case Mustache_tkn_def.Variable: tkn = new Mustache_tkn_variable(val_bry); break;
case Mustache_tkn_def.Comment: tkn = new Mustache_tkn_comment(); break;
case Mustache_tkn_def.Partial: tkn = new Mustache_tkn_partial(val_bry, template_root); break;
case Mustache_tkn_def.Delimiter_bgn: tkn = new Mustache_tkn_delimiter(val_bry); break; // TODO_OLD: implement delimiter; EX: {{=<% %>=}}
case Mustache_tkn_def.Escape_bgn: tkn = new Mustache_tkn_escape(val_bry); break;
case Mustache_tkn_def.Section: tkn = new Mustache_tkn_section(val_bry); break;
case Mustache_tkn_def.Inverted: tkn = new Mustache_tkn_inverted(val_bry); break;
case Mustache_tkn_def.Grp_end: {
return -(rhs_end); // pop the stack
}
}
subs_list.Add(tkn);
if (tkn_data.parse_grp) {
return Parse_grp(tkn, rhs_end);
}
else
return rhs_end;
}
private Err Fail(int pos, String fmt, Object... args) {
return Err_.new_("mustache", fmt, "excerpt", Bry_.Mid_by_len_safe(src, pos, 32));
}
private static int Trim_bwd_to_nl(byte[] src, int txt_bgn, int txt_end) {
int stop = txt_bgn - 1;
int pos = txt_end - 1;
while (pos > stop) {
byte b = src[pos];
switch (b) {
case Byte_ascii.Tab:
case Byte_ascii.Space: --pos; break;
case Byte_ascii.Nl: return pos + 1; // 1 char after \n
default: return -1;
}
}
return -1;
}
private static int Trim_fwd_to_nl(byte[] src, int txt_bgn, int txt_end) {
int pos = txt_bgn;
while (pos < txt_end) {
byte b = src[pos];
switch (b) {
case Byte_ascii.Tab:
case Byte_ascii.Space: ++pos; break;
case Byte_ascii.Nl: return pos;
default: return -1;
}
}
return -1;
}
}
class Mustache_tkn_data {
public int tid;
public int lhs_end_adj;
public byte rhs_bgn_chk;
public boolean parse_grp;
public boolean ws_ignore;
public Mustache_tkn_data(byte b) {
tid = b;
parse_grp = ws_ignore = false;
lhs_end_adj = 1;
rhs_bgn_chk = Byte_ascii.Null;
switch (b) {
default: lhs_end_adj = 0; tid = Mustache_tkn_def.Variable; break;
case Mustache_tkn_def.Comment:
case Mustache_tkn_def.Partial:
case Mustache_tkn_def.Grp_end: ws_ignore = true; break;
case Mustache_tkn_def.Delimiter_bgn: rhs_bgn_chk = Mustache_tkn_def.Delimiter_end; break; // check for "=}}"; TODO_OLD: implement delimiter; EX: {{=<% %>=}}
case Mustache_tkn_def.Escape_bgn: rhs_bgn_chk = Mustache_tkn_def.Escape_end; break; // check for ""
case Mustache_tkn_def.Section:
case Mustache_tkn_def.Inverted: ws_ignore = true; parse_grp = true; break;
}
}
}
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2020 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.mustaches;
import gplx.Bry_;
import gplx.Bry_find_;
import gplx.Byte_ascii;
import gplx.Err;
import gplx.Err_;
import gplx.Io_mgr;
import gplx.Io_url;
import gplx.List_adp;
import gplx.List_adp_;
public class Mustache_tkn_parser {
private byte[] src; private int src_end;
private Io_url template_root;
private final Mustache_tkn_def tkn_def = new Mustache_tkn_def();
public Mustache_tkn_parser() {
}
public Mustache_tkn_parser(Io_url template_root) {
this.template_root = template_root;
}
public Mustache_tkn_itm Parse(String template) { return Parse(template, Bry_.Empty); }
public Mustache_tkn_itm Parse(String template, byte[] default_text) {
byte[] template_data = Io_mgr.Instance.LoadFilBryOr(template_root.GenSubFil_nest(template + ".mustache"), default_text);
return Parse(template_data, 0, template_data.length);
}
public Mustache_tkn_itm Parse(byte[] src) {return Parse(src, 0, src.length);}
public Mustache_tkn_itm Parse(byte[] src, int src_bgn, int src_end) {
this.src = src; this.src_end = src_end;
Mustache_tkn_root root = new Mustache_tkn_root();
Parse_grp(root, src_bgn);
return root;
}
private int Parse_grp(Mustache_tkn_itm owner, int src_bgn) {
List_adp subs_list = List_adp_.New();
int txt_bgn = src_bgn;
boolean end_grp = false;
while (true) {// loop for "{{"
int lhs_bgn = Bry_find_.Find_fwd(src, tkn_def.Variable_lhs, txt_bgn, src_end); // next "{{"
if (lhs_bgn == Bry_find_.Not_found) { // no more "{{"
subs_list.Add(new Mustache_tkn_text(src, txt_bgn, src_end)); // add everything between prv "}}" and cur "{{"
break;
}
int lhs_end = lhs_bgn + tkn_def.Variable_lhs_len;
Mustache_tkn_data tkn_data = new Mustache_tkn_data(src[lhs_end]); // preview tkn
lhs_end += tkn_data.lhs_end_adj;
int rhs_bgn = Bry_find_.Find_fwd(src, tkn_def.Variable_rhs, lhs_end, src_end); // next "}}"
if (rhs_bgn == Bry_find_.Not_found) throw Fail(lhs_bgn, "unclosed tag"); // fail if no "}}"
int rhs_end = rhs_bgn + tkn_def.Variable_rhs_len;
if (tkn_data.rhs_bgn_chk != Byte_ascii.Null) {
if (src[rhs_bgn] != tkn_data.rhs_bgn_chk) throw Fail(lhs_end, "invalid check byte");
++rhs_end; // skip the chk_byte; note that bottom of function will skip "}}" by adding +2
}
int txt_end = lhs_bgn; // get text tkn
if (tkn_data.ws_ignore) {
int new_txt_bgn = Trim_bwd_to_nl(src, txt_bgn, txt_end);
if (new_txt_bgn != -1) {
int new_txt_end = Trim_fwd_to_nl(src, rhs_end, src_end);
if (new_txt_end != -1) {
txt_end = new_txt_bgn;
rhs_end = new_txt_end == src_end ? src_end : new_txt_end + 1;
}
}
}
if (txt_end > txt_bgn) // ignore 0-byte text tkns; occurs when consecutive tkns; EX: {{v1}}{{v2}} will try to create text tkn between "}}{{"
subs_list.Add(new Mustache_tkn_text(src, txt_bgn, txt_end)); // add everything between prv "}}" and cur "{{"
txt_bgn = Parse_itm(tkn_data, subs_list, lhs_end, rhs_bgn, rhs_end); // do parse
if (txt_bgn < 0) { // NOTE: txt_bgn < 0 means end grp
txt_bgn *= -1;
end_grp = true;
}
if (end_grp) break;
}
if (subs_list.Len() > 0) // don't create subs if no members
owner.Subs_ary_((Mustache_tkn_itm[])subs_list.ToAryAndClear(Mustache_tkn_itm.class));
return txt_bgn;
}
private int Parse_itm(Mustache_tkn_data tkn_data, List_adp subs_list, int lhs_end, int rhs_bgn, int rhs_end) {
byte[] val_bry = Bry_.Mid(src, lhs_end, rhs_bgn);
Mustache_tkn_base tkn = null;
switch (tkn_data.tid) {
default: throw Err_.new_unhandled(tkn_data.tid);
case Mustache_tkn_def.Variable: tkn = new Mustache_tkn_variable(val_bry); break;
case Mustache_tkn_def.Comment: tkn = new Mustache_tkn_comment(); break;
case Mustache_tkn_def.Partial: tkn = new Mustache_tkn_partial(val_bry, template_root); break;
case Mustache_tkn_def.Delimiter_bgn: tkn = new Mustache_tkn_delimiter(val_bry); break; // TODO_OLD: implement delimiter; EX: {{=<% %>=}}
case Mustache_tkn_def.Escape_bgn: tkn = new Mustache_tkn_escape(val_bry); break;
case Mustache_tkn_def.Section: tkn = new Mustache_tkn_section(val_bry); break;
case Mustache_tkn_def.Inverted: tkn = new Mustache_tkn_inverted(val_bry); break;
case Mustache_tkn_def.Grp_end: {
return -(rhs_end); // pop the stack
}
}
subs_list.Add(tkn);
if (tkn_data.parse_grp) {
return Parse_grp(tkn, rhs_end);
}
else
return rhs_end;
}
private Err Fail(int pos, String fmt, Object... args) {
return Err_.new_("mustache", fmt, "excerpt", Bry_.Mid_by_len_safe(src, pos, 32));
}
private static int Trim_bwd_to_nl(byte[] src, int txt_bgn, int txt_end) {
int stop = txt_bgn - 1;
int pos = txt_end - 1;
while (pos > stop) {
byte b = src[pos];
switch (b) {
case Byte_ascii.Tab:
case Byte_ascii.Space: --pos; break;
case Byte_ascii.Nl: return pos + 1; // 1 char after \n
default: return -1;
}
}
return -1;
}
private static int Trim_fwd_to_nl(byte[] src, int txt_bgn, int txt_end) {
int pos = txt_bgn;
while (pos < txt_end) {
byte b = src[pos];
switch (b) {
case Byte_ascii.Tab:
case Byte_ascii.Space: ++pos; break;
case Byte_ascii.Nl: return pos;
default: return -1;
}
}
return -1;
}
}
class Mustache_tkn_data {
public int tid;
public int lhs_end_adj;
public byte rhs_bgn_chk;
public boolean parse_grp;
public boolean ws_ignore;
public Mustache_tkn_data(byte b) {
tid = b;
parse_grp = ws_ignore = false;
lhs_end_adj = 1;
rhs_bgn_chk = Byte_ascii.Null;
switch (b) {
default: lhs_end_adj = 0; tid = Mustache_tkn_def.Variable; break;
case Mustache_tkn_def.Comment:
case Mustache_tkn_def.Partial:
case Mustache_tkn_def.Grp_end: ws_ignore = true; break;
case Mustache_tkn_def.Delimiter_bgn: rhs_bgn_chk = Mustache_tkn_def.Delimiter_end; break; // check for "=}}"; TODO_OLD: implement delimiter; EX: {{=<% %>=}}
case Mustache_tkn_def.Escape_bgn: rhs_bgn_chk = Mustache_tkn_def.Escape_end; break; // check for ""
case Mustache_tkn_def.Section:
case Mustache_tkn_def.Inverted: ws_ignore = true; parse_grp = true; break;
}
}
}

View File

@@ -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.phps; import gplx.*; import gplx.langs.*;
package gplx.langs.phps; import gplx.*;
import gplx.core.log_msgs.*;
/*
NOTE: naive implementation of PHP parser; intended only for parsing Messages**.php files in MediaWiki. Specifically, it assumes the following:
@@ -203,7 +203,7 @@ public class Php_evaluator implements Php_tkn_wkr {
case Php_tkn_.Tid_paren_end:
case Php_tkn_.Tid_brack_end:
mode = Mode_ary_term;
if (frame_stack.Count() == 0)
if (frame_stack.Len() == 0)
cur_ary = null;
else {
Php_scanner_frame frame = (Php_scanner_frame)List_adp_.Pop(frame_stack);
@@ -229,7 +229,7 @@ public class Php_evaluator implements Php_tkn_wkr {
case Php_tkn_.Tid_paren_end:
case Php_tkn_.Tid_brack_end:
mode = Mode_ary_term;
if (frame_stack.Count() == 0)
if (frame_stack.Len() == 0)
cur_ary = null;
else {
Php_scanner_frame frame = (Php_scanner_frame)List_adp_.Pop(frame_stack);

View File

@@ -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.phps; import gplx.*; import gplx.langs.*;
package gplx.langs.phps; import gplx.*;
import gplx.core.btries.*; import gplx.core.log_msgs.*;
public class Php_parser {
private final Btrie_slim_mgr trie = Btrie_slim_mgr.ci_a7(); // NOTE:ci:PHP tkns are ASCII
@@ -50,8 +50,8 @@ public class Php_parser {
Init_lxr(list, new Php_lxr_num());
Init_lxr(list, new Php_lxr_quote(Byte_ascii.Apos));
Init_lxr(list, new Php_lxr_quote(Byte_ascii.Quote));
lxrs = (Php_lxr[])list.To_ary(Php_lxr.class);
lxrs_len = list.Count();
lxrs = (Php_lxr[])list.ToAry(Php_lxr.class);
lxrs_len = list.Len();
}
private void Init_lxr(List_adp list, Php_lxr lxr) {
lxr.Lxr_ini(trie, parser_interrupts);

View File

@@ -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.phps; import gplx.*; import gplx.langs.*;
package gplx.langs.phps; import gplx.*;
import gplx.core.tests.*; import gplx.core.log_msgs.*;
class Php_parser_fxt {
Php_tkn_factory tkn_factory = new Php_tkn_factory();
@@ -54,7 +54,7 @@ class Php_parser_fxt {
public void tst_tkns(String raw, Php_tkn_chkr_base... expd) {
byte[] raw_bry = Bry_.new_u8(raw);
parser.Parse_tkns(raw_bry, tkn_wkr);
Php_tkn[] actl = (Php_tkn[])tkn_wkr.List().To_ary(Php_tkn.class);
Php_tkn[] actl = (Php_tkn[])tkn_wkr.List().ToAry(Php_tkn.class);
tst_mgr.Vars().Clear().Add("raw_bry", raw_bry);
tst_mgr.Tst_ary("", expd, actl);
log_mgr_chkr.tst(tst_mgr, tkn_wkr.Msg_log());
@@ -62,7 +62,7 @@ class Php_parser_fxt {
public void tst_lines(String raw, Php_line_assign_chkr... expd) {
byte[] raw_bry = Bry_.new_u8(raw);
parser.Parse_tkns(raw_bry, line_wkr);
Php_line[] actl = (Php_line[])line_wkr.List().To_ary(Php_line.class);
Php_line[] actl = (Php_line[])line_wkr.List().ToAry(Php_line.class);
tst_mgr.Vars().Clear().Add("raw_bry", raw_bry);
tst_mgr.Tst_ary("", expd, actl);
log_mgr_chkr.tst(tst_mgr, line_wkr.Msg_log());
@@ -71,7 +71,7 @@ class Php_parser_fxt {
line_wkr.Clear();
byte[] raw_bry = Bry_.new_u8("$var =\"" + raw +"\";");
parser.Parse_tkns(raw_bry, line_wkr);
Php_line[] actl_lines = (Php_line[])line_wkr.List().To_ary(Php_line.class);
Php_line[] actl_lines = (Php_line[])line_wkr.List().ToAry(Php_line.class);
Php_line_assign actl_line = (Php_line_assign)actl_lines[0];
Php_itm_quote actl = (Php_itm_quote)actl_line.Val();
Tfds.Eq_str(expd, String_.new_u8(actl.Val_obj_bry()));
@@ -280,7 +280,7 @@ class Gfo_msg_log_chkr implements Tst_chkr {
Gfo_msg_data[] actl_itms = new Gfo_msg_data[actl_itms_len];
for (int i = 0; i < actl_itms_len; i++)
actl_itms[i] = actl.Ary_get(i);
mgr.Tst_ary("itms", (Gfo_msg_data_chkr[])itms.To_ary(Gfo_msg_data_chkr.class), actl_itms);
mgr.Tst_ary("itms", (Gfo_msg_data_chkr[])itms.ToAry(Gfo_msg_data_chkr.class), actl_itms);
}
}
class Gfo_msg_data_chkr implements Tst_chkr {

View File

@@ -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.phps; import gplx.*; import gplx.langs.*;
package gplx.langs.phps; import gplx.*;
import gplx.core.primitives.*;
public class Php_text_itm_parser {
public static final byte Rslt_orig = 0, Rslt_dirty = 1, Rslt_fmt = 2;
@@ -26,7 +26,7 @@ public class Php_text_itm_parser {
case Rslt_dirty:
case Rslt_fmt:
tmp_bfr.Clear();
int tmp_list_len = tmp_list.Count();
int tmp_list_len = tmp_list.Len();
for (int i = 0; i < tmp_list_len; i++) {
Php_text_itm itm = (Php_text_itm)tmp_list.Get_at(i);
itm.Bld(tmp_bfr, raw);

View File

@@ -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.phps; import gplx.*; import gplx.langs.*;
package gplx.langs.phps; import gplx.*;
import org.junit.*;
public class Php_text_itm_tst {
@Before public void init() {fxt.Clear();} private Php_text_itm_fxt fxt = new Php_text_itm_fxt();
@@ -41,7 +41,7 @@ class Php_text_itm_fxt {
byte[] raw = Bry_.new_u8(raw_str);
parser.Parse(list, raw);
Bry_bfr bfr = Bry_bfr_.Reset(255);
int list_len = list.Count();
int list_len = list.Len();
for (int i = 0; i < list_len; i++) {
Php_text_itm itm = (Php_text_itm)list.Get_at(i);
itm.Bld(bfr, raw);

View File

@@ -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.regxs; 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.regxs; import gplx.*;
public class Gfo_pattern_itm_ {
public static final byte Tid_text = 0, Tid_wild = 1;
public static Gfo_pattern_itm[] Compile(byte[] raw) {
@@ -44,6 +44,6 @@ public class Gfo_pattern_itm_ {
++pos;
if (last) break;
}
return (Gfo_pattern_itm[])rv.To_ary_and_clear(Gfo_pattern_itm.class);
return (Gfo_pattern_itm[])rv.ToAryAndClear(Gfo_pattern_itm.class);
}
}

View File

@@ -18,7 +18,9 @@ import gplx.core.tests.*; import gplx.core.log_msgs.*;
import gplx.xowa.apps.cfgs.*;
import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*; import gplx.xowa.langs.msgs.*;
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.amps.*; import gplx.xowa.parsers.apos.*; import gplx.xowa.parsers.hdrs.*; import gplx.xowa.parsers.lists.*; import gplx.xowa.parsers.paras.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.tmpls.*; import gplx.xowa.parsers.miscs.*; import gplx.xowa.parsers.tblws.*; import gplx.xowa.parsers.lnkes.*; import gplx.xowa.parsers.lnkis.*;
import gplx.xowa.parsers.*;
import gplx.xowa.parsers.apos.*;
import gplx.xowa.parsers.lists.*; import gplx.xowa.parsers.paras.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.tmpls.*; import gplx.xowa.parsers.miscs.*; import gplx.xowa.parsers.tblws.*; import gplx.xowa.parsers.lnkes.*; import gplx.xowa.parsers.lnkis.*;
import gplx.xowa.files.exts.*; import gplx.xowa.files.repos.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*;
import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.domains.*;
import gplx.xowa.wikis.tdbs.hives.*;
@@ -352,12 +354,12 @@ public class Xop_fxt {
actl_list.Add(String_.new_u8(eny.Item().Path_bry()));
}
}
String[] actl = actl_list.To_str_ary();
String[] actl = actl_list.ToStrAry();
msg_log.Clear();
return actl;
}
public Xop_fxt tst_Log_check() {
int len = log_itms.Count();
int len = log_itms.Len();
String[] expd = new String[len];
for (int i = 0; i < len; i++) {
Gfo_msg_itm itm = (Gfo_msg_itm)log_itms.Get_at(i);
@@ -371,7 +373,7 @@ public class Xop_fxt {
public void tst_Warn(String... expd) {
Gfo_usr_dlg usr_dlg = app.Usr_dlg();
Gfo_usr_dlg__gui_mock ui_wkr = (Gfo_usr_dlg__gui_mock)usr_dlg.Gui_wkr();
String[] actl = ui_wkr.Warns().To_str_ary();
String[] actl = ui_wkr.Warns().ToStrAry();
Tfds.Eq_ary_str(expd, actl);
}
public void Test_parse_page(String ttl, String expd) {

View File

@@ -15,17 +15,22 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa; import gplx.*;
import gplx.core.brys.*; import gplx.core.primitives.*; import gplx.core.brys.fmtrs.*; import gplx.core.ios.*;
import gplx.xowa.apps.*; import gplx.xowa.apps.fsys.*; import gplx.xowa.apps.cfgs.*; import gplx.xowa.apps.urls.*;
import gplx.xowa.apps.*;
import gplx.xowa.apps.cfgs.*; import gplx.xowa.apps.urls.*;
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*; import gplx.xowa.langs.cases.*;
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.xwikis.*; import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.pages.*; import gplx.xowa.wikis.metas.*; import gplx.xowa.wikis.data.site_stats.*; import gplx.xowa.wikis.ttls.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa.wikis.caches.*; import gplx.xowa.wikis.fsys.*;
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.xwikis.*; import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.pages.*; import gplx.xowa.wikis.metas.*; import gplx.xowa.wikis.data.site_stats.*;
import gplx.xowa.wikis.data.*;
import gplx.xowa.wikis.caches.*; import gplx.xowa.wikis.fsys.*;
import gplx.xowa.users.*; import gplx.xowa.htmls.*; import gplx.xowa.users.history.*; import gplx.xowa.specials.*; import gplx.xowa.xtns.*; import gplx.xowa.wikis.dbs.*;
import gplx.xowa.files.*; import gplx.xowa.files.repos.*; import gplx.xowa.files.origs.*; import gplx.xowa.files.bins.*; import gplx.fsdb.*; import gplx.fsdb.meta.*; import gplx.xowa.files.exts.*;
import gplx.xowa.htmls.heads.*; import gplx.xowa.htmls.core.htmls.utls.*; import gplx.xowa.htmls.core.hzips.*; import gplx.xowa.htmls.core.*; import gplx.xowa.htmls.ns_files.*; import gplx.xowa.htmls.bridges.dbuis.tbls.*; import gplx.xowa.htmls.hrefs.*; import gplx.xowa.htmls.hxtns.pages.*;
import gplx.xowa.bldrs.xmls.*; import gplx.xowa.bldrs.installs.*; import gplx.xowa.bldrs.setups.maints.*;
import gplx.xowa.files.*; import gplx.xowa.files.repos.*; import gplx.xowa.files.origs.*; import gplx.xowa.files.bins.*; import gplx.fsdb.*; import gplx.fsdb.meta.*;
import gplx.xowa.htmls.heads.*; import gplx.xowa.htmls.core.htmls.utls.*;
import gplx.xowa.htmls.core.*; import gplx.xowa.htmls.ns_files.*;
import gplx.xowa.htmls.hrefs.*; import gplx.xowa.htmls.hxtns.pages.*;
import gplx.xowa.bldrs.xmls.*;
import gplx.xowa.bldrs.setups.maints.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.utils.*;
import gplx.xowa.addons.wikis.ctgs.*;
import gplx.xowa.guis.cbks.*; import gplx.xowa.guis.views.*;
import gplx.xowa.xtns.gallery.*; import gplx.xowa.xtns.pfuncs.*;
import gplx.xowa.guis.cbks.*;
import gplx.xowa.xtns.pfuncs.*;
import gplx.xowa.wikis.tdbs.*; import gplx.xowa.wikis.tdbs.hives.*;
import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.htmls.css.mgrs.*; import gplx.xowa.addons.wikis.ctgs.htmls.pageboxs.*; import gplx.xowa.addons.wikis.ctgs.htmls.catpages.*;
public class Xowe_wiki implements Xow_wiki, Gfo_invk, Gfo_evt_itm {
@@ -273,7 +278,7 @@ public class Xowe_wiki implements Xow_wiki, Gfo_invk, Gfo_evt_itm {
}
public void Rls() {
if (rls_list != null) {
int len = rls_list.Count();
int len = rls_list.Len();
for (int i = 0; i < len; i++) {
Rls_able rls = (Rls_able)rls_list.Get_at(i);
rls.Rls();

View File

@@ -29,7 +29,7 @@ import gplx.xowa.addons.wikis.searchs.specials.Srch_special_cfg;
public class Xoax_addon_mgr {
private final Ordered_hash hash = Ordered_hash_.New(); // LOCK: must synchronized else two search tabs will fail on startup
public Xoax_addon_itm Itms__get_or_null(String key) {synchronized (hash) {return (Xoax_addon_itm)hash.Get_by(key);}}
public Xoax_addon_itm Itms__get_or_null(String key) {synchronized (hash) {return (Xoax_addon_itm)hash.GetByOrNull(key);}}
public void Itms__add_many(Xoax_addon_itm... ary) {
for (Xoax_addon_itm itm : ary)
Itms__add(itm);

View File

@@ -13,16 +13,16 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.addons.apps.cfgs.dbs.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*; import gplx.xowa.addons.apps.cfgs.dbs.*;
package gplx.xowa.addons.apps.cfgs.dbs.tbls; import gplx.*;
import gplx.dbs.*; import gplx.dbs.utls.*;
public class Xocfg_grp_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld__grp_id, fld__grp_key;
private final Db_conn conn;
public Xocfg_grp_tbl(Db_conn conn) {
this.conn = conn;
this.fld__grp_id = flds.Add_int_pkey("grp_id");
this.fld__grp_key = flds.Add_str("grp_key", 255);
this.fld__grp_id = flds.AddIntPkey("grp_id");
this.fld__grp_key = flds.AddStr("grp_key", 255);
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name = TBL_NAME;

View File

@@ -13,22 +13,22 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.addons.apps.cfgs.dbs.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*; import gplx.xowa.addons.apps.cfgs.dbs.*;
package gplx.xowa.addons.apps.cfgs.dbs.tbls; import gplx.*;
import gplx.dbs.*; import gplx.dbs.utls.*;
public class Xocfg_itm_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld__itm_id, fld__itm_key, fld__itm_scope, fld__itm_type, fld__itm_dflt, fld__itm_html_atrs, fld__itm_html_cls;
private final Db_conn conn;
public Xocfg_itm_tbl(Db_conn conn) {
this.conn = conn;
this.tbl_name = "cfg_itm";
this.fld__itm_id = flds.Add_int_pkey("itm_id"); // EX: '1'
this.fld__itm_key = flds.Add_str("itm_key", 255); // EX: 'cfg_1'
this.fld__itm_scope = flds.Add_int("itm_scope"); // EX: '1'; ENUM: Xoitm_scope_enum
this.fld__itm_type = flds.Add_str("itm_type", 255); // EX: '1'; ENUM: Xoitm_type_enum
this.fld__itm_dflt = flds.Add_str("itm_dflt", 4096); // EX: 'abc'
this.fld__itm_html_atrs = flds.Add_str("itm_html_atrs", 255); // EX: 'size="5"'
this.fld__itm_html_cls = flds.Add_str("itm_html_cls", 255); // EX: 'xocfg__bool__readonly'
this.fld__itm_id = flds.AddIntPkey("itm_id"); // EX: '1'
this.fld__itm_key = flds.AddStr("itm_key", 255); // EX: 'cfg_1'
this.fld__itm_scope = flds.AddInt("itm_scope"); // EX: '1'; ENUM: Xoitm_scope_enum
this.fld__itm_type = flds.AddStr("itm_type", 255); // EX: '1'; ENUM: Xoitm_type_enum
this.fld__itm_dflt = flds.AddStr("itm_dflt", 4096); // EX: 'abc'
this.fld__itm_html_atrs = flds.AddStr("itm_html_atrs", 255); // EX: 'size="5"'
this.fld__itm_html_cls = flds.AddStr("itm_html_cls", 255); // EX: 'xocfg__bool__readonly'
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;

View File

@@ -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.xowa.addons.apps.cfgs.dbs.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*; import gplx.xowa.addons.apps.cfgs.dbs.*;
package gplx.xowa.addons.apps.cfgs.dbs.tbls; import gplx.*;
import gplx.dbs.*; import gplx.dbs.utls.*;
public class Xocfg_map_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld__map_src, fld__map_trg, fld__map_sort;
private final Db_conn conn;
public Xocfg_map_tbl(Db_conn conn) {
this.conn = conn;
this.tbl_name = "cfg_map";
this.fld__map_src = flds.Add_int("map_src");
this.fld__map_trg = flds.Add_int("map_trg");
this.fld__map_sort = flds.Add_int("map_sort");
this.fld__map_src = flds.AddInt("map_src");
this.fld__map_trg = flds.AddInt("map_trg");
this.fld__map_sort = flds.AddInt("map_sort");
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;

View File

@@ -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.xowa.addons.apps.cfgs.dbs.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*; import gplx.xowa.addons.apps.cfgs.dbs.*;
package gplx.xowa.addons.apps.cfgs.dbs.tbls; import gplx.*;
import gplx.dbs.*; import gplx.dbs.utls.*;
public class Xocfg_txt_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld__nde_id, fld__nde_lang, fld__nde_name, fld__nde_help;
private final Db_conn conn;
public Xocfg_txt_tbl(Db_conn conn) {
this.conn = conn;
this.tbl_name = "cfg_txt";
this.fld__nde_id = flds.Add_int_pkey("nde_id"); // EX: '2'
this.fld__nde_lang = flds.Add_str("nde_lang", 16); // EX: 'en'
this.fld__nde_name = flds.Add_str("nde_name", 255); // EX: 'Cfg Name'
this.fld__nde_help = flds.Add_str("nde_help", 4096); // EX: 'Help text'
this.fld__nde_id = flds.AddIntPkey("nde_id"); // EX: '2'
this.fld__nde_lang = flds.AddStr("nde_lang", 16); // EX: 'en'
this.fld__nde_name = flds.AddStr("nde_name", 255); // EX: 'Cfg Name'
this.fld__nde_help = flds.AddStr("nde_help", 4096); // EX: 'Help text'
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;

View File

@@ -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.xowa.addons.apps.cfgs.dbs.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*; import gplx.xowa.addons.apps.cfgs.dbs.*;
package gplx.xowa.addons.apps.cfgs.dbs.tbls; import gplx.*;
import gplx.dbs.*; import gplx.dbs.utls.*;
public class Xocfg_val_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld__itm_key, fld__itm_ctx, fld__itm_val, fld__itm_date;
private final Db_conn conn;
public Xocfg_val_tbl(Db_conn conn) {
this.conn = conn;
this.tbl_name = "cfg_val";
this.fld__itm_key = flds.Add_str("itm_key", 255); // EX: 'xowa.app.cfg_1'
this.fld__itm_ctx = flds.Add_str("itm_ctx", 255); // EX: 'app'; 'en.w'; 'ns-10'
this.fld__itm_val = flds.Add_str("itm_val", 4096); // EX: 'abc'
this.fld__itm_date = flds.Add_str("itm_date", 16); // EX: '20160901_010203'
this.fld__itm_key = flds.AddStr("itm_key", 255); // EX: 'xowa.app.cfg_1'
this.fld__itm_ctx = flds.AddStr("itm_ctx", 255); // EX: 'app'; 'en.w'; 'ns-10'
this.fld__itm_val = flds.AddStr("itm_val", 4096); // EX: 'abc'
this.fld__itm_date = flds.AddStr("itm_date", 16); // EX: '20160901_010203'
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;
@@ -54,7 +54,7 @@ public class Xocfg_val_tbl implements Db_tbl {
}
}
finally {rdr.Rls();}
return (Xocfg_val_row[])list.To_ary_and_clear(Xocfg_val_row.class);
return (Xocfg_val_row[])list.ToAryAndClear(Xocfg_val_row.class);
}
private Xocfg_val_row Load(Db_rdr rdr) {
return new Xocfg_val_row

View File

@@ -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.xowa.addons.apps.cfgs.mgrs.caches; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*; import gplx.xowa.addons.apps.cfgs.mgrs.*;
package gplx.xowa.addons.apps.cfgs.mgrs.caches; import gplx.*;
import gplx.xowa.addons.apps.cfgs.*;
public class Xocfg_cache_grp {
private final Hash_adp vals = Hash_adp_.New();
private final Ordered_hash subs = Ordered_hash_.New();
@@ -28,18 +29,18 @@ public class Xocfg_cache_grp {
public void Dflt_(String v) {this.dflt = v;}
public String Get(String ctx) {
// exact match; EX: "en.w|key_1"
Xocfg_cache_itm rv = (Xocfg_cache_itm)vals.Get_by(ctx);
Xocfg_cache_itm rv = (Xocfg_cache_itm)vals.GetByOrNull(ctx);
if (rv != null) return rv.Val();
// global match; EX: "app|key_1"
rv = (Xocfg_cache_itm)vals.Get_by(Xocfg_mgr.Ctx__app);
rv = (Xocfg_cache_itm)vals.GetByOrNull(Xocfg_mgr.Ctx__app);
if (rv != null) return rv.Val();
// dflt
return dflt;
}
public void Set(String ctx, String val) {
Xocfg_cache_itm rv = (Xocfg_cache_itm)vals.Get_by(ctx);
Xocfg_cache_itm rv = (Xocfg_cache_itm)vals.GetByOrNull(ctx);
if (rv == null) {
rv = new Xocfg_cache_itm(ctx, key, val);
vals.Add(ctx, rv);
@@ -55,7 +56,7 @@ public class Xocfg_cache_grp {
vals.Add(ctx, itm);
}
public void Sub(Gfo_invk sub, String ctx, String evt) {
List_adp list = (List_adp)subs.Get_by(ctx);
List_adp list = (List_adp)subs.GetByOrNull(ctx);
if (list == null) {
list = List_adp_.New();
subs.Add(ctx, list);
@@ -64,7 +65,7 @@ public class Xocfg_cache_grp {
}
public void Pub(String ctx, String val) {
// exact match; EX: "en.w|key_1"
List_adp list = (List_adp)subs.Get_by(ctx);
List_adp list = (List_adp)subs.GetByOrNull(ctx);
if (list == null) {// global match; EX: "app|key_1"
int len = subs.Len();
for (int i = 0; i < len; i++) {

View File

@@ -13,9 +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.xowa.addons.apps.cfgs.mgrs.caches; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*; import gplx.xowa.addons.apps.cfgs.mgrs.*;
package gplx.xowa.addons.apps.cfgs.mgrs.caches; import gplx.*;
import gplx.xowa.addons.apps.cfgs.*;
import gplx.dbs.*;
import gplx.xowa.addons.apps.cfgs.dbs.*; import gplx.xowa.addons.apps.cfgs.dbs.tbls.*; import gplx.xowa.addons.apps.cfgs.enums.*;
import gplx.xowa.addons.apps.cfgs.dbs.*; import gplx.xowa.addons.apps.cfgs.dbs.tbls.*;
public class Xocfg_cache_mgr {
private final Hash_adp grps = Hash_adp_.New();
public Xocfg_cache_mgr() {
@@ -34,7 +35,7 @@ public class Xocfg_cache_mgr {
return grp.Get(ctx);
}
public String Get_or(String ctx, String key, String or) {
Xocfg_cache_grp grp = (Xocfg_cache_grp)grps.Get_by(key);
Xocfg_cache_grp grp = (Xocfg_cache_grp)grps.GetByOrNull(key);
if (grp == null) {
grp = Load_grp(key, or);
grps.Add(key, grp);
@@ -74,7 +75,7 @@ public class Xocfg_cache_mgr {
grp.Pub(Xocfg_mgr.Ctx__app, val); // need to pub after dflt is changed; for now, just pub at app-level
}
public Xocfg_cache_grp Grps__get_or_load(String key) {
Xocfg_cache_grp grp = (Xocfg_cache_grp)grps.Get_by(key);
Xocfg_cache_grp grp = (Xocfg_cache_grp)grps.GetByOrNull(key);
if (grp == null) {
grp = Load_grp(key, "");
grps.Add(key, grp);

View File

@@ -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.xowa.addons.apps.cfgs.mgrs.dflts; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*; import gplx.xowa.addons.apps.cfgs.mgrs.*;
package gplx.xowa.addons.apps.cfgs.mgrs.dflts; import gplx.*; import gplx.xowa.*;
import gplx.xowa.addons.apps.cfgs.mgrs.caches.*;
public class Xocfg_dflt_mgr {
private final Xocfg_cache_mgr cache_mgr;
@@ -22,7 +22,7 @@ public class Xocfg_dflt_mgr {
this.cache_mgr = cache_mgr;
}
public String Get_or(String key, String or) {
Gfo_invk itm = (Gfo_invk)hash.Get_by(key);
Gfo_invk itm = (Gfo_invk)hash.GetByOrNull(key);
return (itm == null) ? or : (String)Gfo_invk_.Invk_by_key(itm, key);
}
public void Add(String key, String val) {
@@ -31,7 +31,7 @@ public class Xocfg_dflt_mgr {
}
public void Add(Gfo_invk invk, String... keys) {
for (String key : keys) {
hash.Add_if_dupe_use_nth(key, invk);
hash.AddIfDupeUseNth(key, invk);
}
}
public static void Run_os_gfs(String user_name, gplx.xowa.apps.gfs.Xoa_gfs_mgr gfs_mgr, gplx.xowa.apps.fsys.Xoa_fsys_mgr fsys_mgr) {

View File

@@ -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.xowa.addons.apps.cfgs.mgrs.execs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*; import gplx.xowa.addons.apps.cfgs.mgrs.*;
package gplx.xowa.addons.apps.cfgs.mgrs.execs; import gplx.*;
public class Xocfg_exec_mgr {
private final Ordered_hash hash = Ordered_hash_.New();
public void Add(Gfo_invk invk, String... cmds) {
@@ -22,7 +22,7 @@ public class Xocfg_exec_mgr {
}
}
public void Exec(String cmd, Object... args) {
Gfo_invk invk = (Gfo_invk)hash.Get_by(cmd);
Gfo_invk invk = (Gfo_invk)hash.GetByOrNull(cmd);
// create msg and add args
GfoMsg msg = GfoMsg_.new_parse_(cmd);

View File

@@ -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.xowa.addons.apps.cfgs.mgrs.types; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*; import gplx.xowa.addons.apps.cfgs.mgrs.*;
package gplx.xowa.addons.apps.cfgs.mgrs.types; import gplx.*;
public class Xocfg_type_mgr {
private final Ordered_hash list_hash = Ordered_hash_.New();
public Xocfg_type_mgr() {
@@ -42,6 +42,6 @@ public class Xocfg_type_mgr {
list_hash.Add(key, itms);
}
public Keyval[] Lists__get(String key) {
return (Keyval[])list_hash.Get_by_or_fail(key);
return (Keyval[])list_hash.GetByOrFail(key);
}
}

View File

@@ -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.xowa.addons.apps.cfgs.specials.edits.objs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*; import gplx.xowa.addons.apps.cfgs.specials.*; import gplx.xowa.addons.apps.cfgs.specials.edits.*;
package gplx.xowa.addons.apps.cfgs.specials.edits.objs; import gplx.*;
import gplx.langs.mustaches.*;
import gplx.core.gfobjs.*;
public class Xoedit_grp implements Xoedit_nde, Mustache_doc_itm {
@@ -49,7 +49,7 @@ public class Xoedit_grp implements Xoedit_nde, Mustache_doc_itm {
Xoedit_itm itm = itms[i];
list.Add(itm.To_nde(tmp_bfr));
}
rv.Add_ary("itms", new Gfobj_ary((Gfobj_nde[])list.To_ary_and_clear(Gfobj_nde.class)));
rv.Add_ary("itms", new Gfobj_ary((Gfobj_nde[])list.ToAryAndClear(Gfobj_nde.class)));
return rv;
}
public boolean Mustache__write(String k, Mustache_bfr bfr) {

View File

@@ -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.xowa.addons.apps.cfgs.specials.edits.objs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*; import gplx.xowa.addons.apps.cfgs.specials.*; import gplx.xowa.addons.apps.cfgs.specials.edits.*;
package gplx.xowa.addons.apps.cfgs.specials.edits.objs; import gplx.*;
public class Xoedit_nde_hash {
private final Ordered_hash hash = Ordered_hash_.New();
private final Ordered_hash id_hash = Ordered_hash_.New();
@@ -29,10 +29,10 @@ public class Xoedit_nde_hash {
return (Xoedit_nde)hash.Get_at(i);
}
public Xoedit_nde Get_by_or_fail(String key) {
return (Xoedit_nde)hash.Get_by_or_fail(key);
return (Xoedit_nde)hash.GetByOrFail(key);
}
public Xoedit_nde Get_by_or_fail(int id) {
return (Xoedit_nde)id_hash.Get_by_or_fail(id);
return (Xoedit_nde)id_hash.GetByOrFail(id);
}
public Xoedit_grp[] To_grp_ary_and_clear() {
Xoedit_grp[] rv = (Xoedit_grp[])hash.To_ary_and_clear(Xoedit_grp.class);

View File

@@ -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.xowa.addons.apps.cfgs.specials.edits.objs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*; import gplx.xowa.addons.apps.cfgs.specials.*; import gplx.xowa.addons.apps.cfgs.specials.edits.*;
package gplx.xowa.addons.apps.cfgs.specials.edits.objs; import gplx.*;
import gplx.langs.mustaches.*;
import gplx.core.gfobjs.*;
public class Xoedit_root implements Mustache_doc_itm {
@@ -36,7 +36,7 @@ public class Xoedit_root implements Mustache_doc_itm {
list.Add(itm.To_nde(tmp_bfr));
}
rv.Add_str("page_help", page_help);
rv.Add_ary("grps", new Gfobj_ary((Gfobj_nde[])list.To_ary_and_clear(Gfobj_nde.class)));
rv.Add_ary("grps", new Gfobj_ary((Gfobj_nde[])list.ToAryAndClear(Gfobj_nde.class)));
return rv;
}
public boolean Mustache__write(String k, Mustache_bfr bfr) {

View File

@@ -67,7 +67,7 @@ public class Xocfg_edit_loader {
grp_list.Add(owner);
// load tree by selecting subs until no more grps
while (grp_temp.Count() > 0) {
while (grp_temp.Len() > 0) {
owner = (Xoedit_grp)grp_temp.Get_at(0);
grp_temp.Del(owner.Id());
Load_subs(grp_list, itm_list, grp_temp, owner);
@@ -147,7 +147,7 @@ public class Xocfg_edit_loader {
finally {
rdr.Rls();
}
return new Xoedit_nav_mgr((Xoedit_nav_itm[])list.To_ary_and_clear(Xoedit_nav_itm.class));
return new Xoedit_nav_mgr((Xoedit_nav_itm[])list.ToAryAndClear(Xoedit_nav_itm.class));
}
private void Load_subs(Xoedit_nde_hash grp_list, Xoedit_nde_hash itm_list, Ordered_hash grp_temp, Xoedit_grp owner) {
String sql = Db_sql_.Make_by_fmt(String_.Ary
@@ -178,7 +178,7 @@ public class Xocfg_edit_loader {
itm_list.Add(gui_itm);
}
}
owner.Itms_((Xoedit_itm[])itms_list.To_ary_and_clear(Xoedit_itm.class));
owner.Itms_((Xoedit_itm[])itms_list.ToAryAndClear(Xoedit_itm.class));
}
private void Load_itm_meta(Bry_bfr tmp_bfr, Xoedit_nde_hash itm_list) {
Xogui_nde_iter iter = Xogui_nde_iter.New_sql(itm_list);

View File

@@ -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.xowa.addons.apps.cfgs.specials.maints.services; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*; import gplx.xowa.addons.apps.cfgs.specials.*; import gplx.xowa.addons.apps.cfgs.specials.maints.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.addons.apps.cfgs.specials.maints.services; import gplx.*;
import gplx.langs.gfs.*;
class Xocfg_maint_parser {
public Xocfg_maint_nde[] Parse(String raw) {
@@ -66,7 +66,7 @@ class Xocfg_maint_parser {
return rv;
}
private static String Get_atr_as_str_or(Ordered_hash hash, String key, String or) {
String val = (String)hash.Get_by(key);
String val = (String)hash.GetByOrNull(key);
return val == null ? or : val;
}
}

View File

@@ -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.xowa.addons.apps.cfgs.upgrades; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.addons.apps.cfgs.upgrades; import gplx.*; import gplx.xowa.*;
import gplx.dbs.*;
import gplx.langs.gfs.*;
public class Xocfg_upgrade_mgr {
@@ -46,7 +46,7 @@ public class Xocfg_upgrade_mgr {
// remap
for (Keyval kv : kvs) {
Keyval mapping = (Keyval)mappings.Get_by(kv.Key());
Keyval mapping = (Keyval)mappings.GetByOrNull(kv.Key());
if (mapping == null) {
Gfo_usr_dlg_.Instance.Log_many("", "", "cfg.convert:could not find mapping; key=~{0} val=~{1}", kv.Key(), kv.Val());
kv.Key_("");
@@ -92,7 +92,7 @@ public class Xocfg_upgrade_mgr {
String args_kv_key = args_kv.Key();
String args_kv_val = args_kv.Val_to_str_or_empty();
if (String_.Has_at_end(args_kv_key, ".args")) {
Keyval cmd_kv = (Keyval)hash.Get_by(String_.Replace(args_kv_key, ".args", ".cmd"));
Keyval cmd_kv = (Keyval)hash.GetByOrNull(String_.Replace(args_kv_key, ".args", ".cmd"));
if (cmd_kv == null) {
Gfo_usr_dlg_.Instance.Log_many("", "", "cfg.convert:could not find cmd; key=~{0} val=~{1}", args_kv_key, args_kv.Val());
continue;

View File

@@ -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.xowa.addons.apps.helps.logs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.helps.*;
import gplx.xowa.specials.*; import gplx.core.net.*; import gplx.core.net.qargs.*; import gplx.xowa.wikis.pages.*;
package gplx.xowa.addons.apps.helps.logs; import gplx.*; import gplx.xowa.*;
import gplx.xowa.specials.*;
import gplx.core.net.qargs.*;
import gplx.core.net.emails.*;
public class Xolog_special implements Xow_special_page {
public void Special__gen(Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) {
@@ -70,7 +71,7 @@ class Xoa_url_args_bldr {
list.Add(Keyval_.new_(key, val));
return this;
}
public Keyval[] To_ary() {return (Keyval[])list.To_ary_and_clear(Keyval.class);}
public Keyval[] To_ary() {return (Keyval[])list.ToAryAndClear(Keyval.class);}
}
class Xolog_file_utl {// yyyyMMdd_HHmmss.log
private static final String Gui__date_fmt = "yyyy-MM-dd HH:mm:ss";

View File

@@ -13,20 +13,21 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.addons.apps.scripts.apis; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.scripts.*;
package gplx.xowa.addons.apps.scripts.apis; import gplx.*;
import gplx.xowa.addons.apps.scripts.*;
public abstract class Xoscript_doc_sect_base {
protected final Xoscript_doc doc;
private final Hash_adp_bry marker_hash = Hash_adp_bry.cs();
private final Bry_bfr tmp_bfr = Bry_bfr_.New();
public Xoscript_doc_sect_base(Xoscript_doc doc) {this.doc = doc;}
private byte[] get_marker_by_pos(byte[] pos_bry) {
return (byte[])marker_hash.Get_by_or_fail(pos_bry);
return (byte[])marker_hash.GetByOrFail(pos_bry);
}
public void reg_marker(String marker_str, String... pos_ary) {
int len = pos_ary.length;
byte[] marker_bry = Bry_.new_u8(marker_str);
for (int i = 0; i < len; ++i) {
marker_hash.Add_if_dupe_use_nth(Bry_.new_u8(pos_ary[i]), marker_bry);
marker_hash.AddIfDupeUseNth(Bry_.new_u8(pos_ary[i]), marker_bry);
}
}
public void add_html(String html) {add_html(Pos__default, html);}

View File

@@ -13,21 +13,21 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.addons.apps.updates.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.updates.*;
import gplx.dbs.*; import gplx.dbs.utls.*;
package gplx.xowa.addons.apps.updates.dbs; import gplx.*;
import gplx.dbs.*;
public class Xoa_app_version_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld__version_id, fld__version_name, fld__version_date, fld__version_priority, fld__version_url, fld__version_summary, fld__version_details;
private final Db_conn conn;
public Xoa_app_version_tbl(Db_conn conn) {
this.conn = conn;
this.fld__version_id = flds.Add_int_pkey("version_id");
this.fld__version_name = flds.Add_str("version_name", 32);
this.fld__version_date = flds.Add_str("version_date", 32);
this.fld__version_priority = flds.Add_int("version_priority"); // 3:trivial; 5:minor; 7:major;
this.fld__version_url = flds.Add_str("version_url", 255);
this.fld__version_summary = flds.Add_str("version_summary", 255);
this.fld__version_details = flds.Add_text("version_details");
this.fld__version_id = flds.AddIntPkey("version_id");
this.fld__version_name = flds.AddStr("version_name", 32);
this.fld__version_date = flds.AddStr("version_date", 32);
this.fld__version_priority = flds.AddInt("version_priority"); // 3:trivial; 5:minor; 7:major;
this.fld__version_url = flds.AddStr("version_url", 255);
this.fld__version_summary = flds.AddStr("version_summary", 255);
this.fld__version_details = flds.AddText("version_details");
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name = TBL_NAME;
@@ -48,7 +48,7 @@ public class Xoa_app_version_tbl implements Db_tbl {
while (rdr.Move_next()) {
list.Add(Load(rdr));
}
return (Xoa_app_version_itm[])list.To_ary_and_clear(Xoa_app_version_itm.class);
return (Xoa_app_version_itm[])list.ToAryAndClear(Xoa_app_version_itm.class);
} finally {rdr.Rls();}
}
public Xoa_app_version_itm Select_by_name_or_null(String name) {

View File

@@ -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.xowa.addons.apps.updates.js; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.updates.*;
package gplx.xowa.addons.apps.updates.js; import gplx.*;
import gplx.xowa.guis.cbks.*;
public class Xojs_wkr__replace extends Xojs_wkr__base {
private final Io_url src_dir, trg_dir;
@@ -46,6 +46,6 @@ public class Xojs_wkr__replace extends Xojs_wkr__base {
}
}
this.failed = (Keyval[])failed_list.To_ary_and_clear(Keyval.class);
this.failed = (Keyval[])failed_list.ToAryAndClear(Keyval.class);
}
}

View File

@@ -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.xowa.addons.bldrs.app_cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.addons.bldrs.app_cfgs; import gplx.*;
public class Xoac_wiki_cfg_bldr_fil implements Gfo_invk {
public Xoac_wiki_cfg_bldr_fil(String wiki) {this.wiki = wiki;}
public String Wiki() {return wiki;} private String wiki;
public int Itms_count() {return list.Count();}
public int Itms_count() {return list.Len();}
public Xoac_wiki_cfg_bldr_cmd Itms_get_at(int i) {return (Xoac_wiki_cfg_bldr_cmd)list.Get_at(i);}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_new_cmd_)) {Itms_add(m.ReadStr("id"), m.ReadStr("text"));}

View File

@@ -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
*/
package gplx.xowa.addons.bldrs.app_cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.addons.bldrs.app_cfgs; import gplx.*; import gplx.xowa.*;
import gplx.core.strings.*;
import gplx.xowa.bldrs.*;
public class Xob_wiki_cfg_bldr implements Gfo_invk {
public Xob_wiki_cfg_bldr(Xob_bldr bldr) {this.app = bldr.App();} private Xoae_app app;
public void Exec() {
int len = hash.Count();
int len = hash.Len();
for (int i = 0; i < len; i++) {
Xoac_wiki_cfg_bldr_fil fil = (Xoac_wiki_cfg_bldr_fil)hash.Get_at(i);
Exec_fil(fil);
@@ -45,7 +45,7 @@ public class Xob_wiki_cfg_bldr implements Gfo_invk {
} private static final String Invk_get = "get", Invk_run = "run";
public void Clear() {hash.Clear();}
public Xoac_wiki_cfg_bldr_fil Itms_get_or_new(String wiki) {
Xoac_wiki_cfg_bldr_fil rv = (Xoac_wiki_cfg_bldr_fil)hash.Get_by(wiki);
Xoac_wiki_cfg_bldr_fil rv = (Xoac_wiki_cfg_bldr_fil)hash.GetByOrNull(wiki);
if (rv == null) {
rv = new Xoac_wiki_cfg_bldr_fil(wiki);
hash.Add(wiki, rv);

View File

@@ -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.xowa.addons.bldrs.app_cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*;
package gplx.xowa.addons.bldrs.app_cfgs; import gplx.*; import gplx.xowa.*;
import org.junit.*; import gplx.core.strings.*;
public class Xob_wiki_cfg_bldr_tst {
Xob_wiki_cfg_bldr_fxt fxt = new Xob_wiki_cfg_bldr_fxt();
@@ -165,7 +165,7 @@ class Xob_wiki_cfg_bldr_fxt {
}
public void Test() {
wiki_cfg_bldr.Exec();
int len = hash.Count();
int len = hash.Len();
for (int i = 0; i < len; i++) {
Keyval kv = (Keyval)hash.Get_at(i);
String wiki = kv.Key();

View File

@@ -57,7 +57,7 @@ public class Xowm_server_cfg_mgr {
Php_parser php_parser = new Php_parser();
Php_evaluator eval = new Php_evaluator(new gplx.core.log_msgs.Gfo_msg_log("test"));
php_parser.Parse_tkns(src, eval);
Php_line[] lines = (Php_line[])eval.List().To_ary(Php_line.class);
Php_line[] lines = (Php_line[])eval.List().ToAry(Php_line.class);
Php_line_assign line = (Php_line_assign)lines[0];
Php_itm_ary root_ary = (Php_itm_ary)line.Val();

View File

@@ -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.xowa.addons.bldrs.centrals.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*;
package gplx.xowa.addons.bldrs.centrals.dbs; import gplx.*;
public class Xobc_task_step_hash {
private final Ordered_hash tasks_hash = Ordered_hash_.New();
private final Ordered_hash steps_hash = Ordered_hash_.New();
@@ -23,7 +23,7 @@ public class Xobc_task_step_hash {
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);
steps_hash.Add_if_dupe_use_nth(step_id, step_id);
tasks_hash.AddIfDupeUseNth(task_id, task_id);
steps_hash.AddIfDupeUseNth(step_id, step_id);
}
}

View File

@@ -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.xowa.addons.bldrs.centrals.dbs.datas; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*; import gplx.xowa.addons.bldrs.centrals.dbs.*;
package gplx.xowa.addons.bldrs.centrals.dbs.datas;
import gplx.dbs.*;
public class Xobc_host_regy_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld_host_id, fld_host_domain, fld_host_data_dir, fld_host_update_dir;
private final Db_conn conn;
public Xobc_host_regy_tbl(Db_conn conn) {
this.conn = conn;
this.tbl_name = "host_regy";
this.fld_host_id = flds.Add_int_pkey("host_id");
this.fld_host_domain = flds.Add_str("host_domain", 255); // EX: archive.org
this.fld_host_data_dir = flds.Add_str("host_data_dir", 255); // EX: download/Xowa_~{host_regy|wiki_abrv}_latest
this.fld_host_update_dir = flds.Add_str("host_update_dir", 255); // EX: download/Xowa_app_support
this.fld_host_id = flds.AddIntPkey("host_id");
this.fld_host_domain = flds.AddStr("host_domain", 255); // EX: archive.org
this.fld_host_data_dir = flds.AddStr("host_data_dir", 255); // EX: download/Xowa_~{host_regy|wiki_abrv}_latest
this.fld_host_update_dir = flds.AddStr("host_update_dir", 255); // EX: download/Xowa_app_support
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;

View File

@@ -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.xowa.addons.bldrs.centrals.dbs.datas; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*; import gplx.xowa.addons.bldrs.centrals.dbs.*;
package gplx.xowa.addons.bldrs.centrals.dbs.datas; import gplx.*;
import gplx.dbs.*;
public class Xobc_lang_regy_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld__lang_id, fld__lang_key, fld__lang_name;
private final Db_conn conn;
public Xobc_lang_regy_tbl(Db_conn conn) {
this.conn = conn;
this.tbl_name = "lang_regy";
this.fld__lang_id = flds.Add_int_pkey("lang_id");
this.fld__lang_key = flds.Add_str("lang_key", 255);
this.fld__lang_name = flds.Add_str("lang_name", 255);
this.fld__lang_id = flds.AddIntPkey("lang_id");
this.fld__lang_key = flds.AddStr("lang_key", 255);
this.fld__lang_name = flds.AddStr("lang_name", 255);
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;
@@ -37,7 +37,7 @@ public class Xobc_lang_regy_tbl implements Db_tbl {
list.Add(new Xobc_lang_regy_itm(rdr.Read_int(fld__lang_id), rdr.Read_str(fld__lang_key), rdr.Read_str(fld__lang_name)));
}
finally {rdr.Rls();}
return (Xobc_lang_regy_itm[])list.To_ary_and_clear(Xobc_lang_regy_itm.class);
return (Xobc_lang_regy_itm[])list.ToAryAndClear(Xobc_lang_regy_itm.class);
}
public void Rls() {}
}

View File

@@ -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.xowa.addons.bldrs.centrals.dbs.datas; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*; import gplx.xowa.addons.bldrs.centrals.dbs.*;
package gplx.xowa.addons.bldrs.centrals.dbs.datas; import gplx.*;
import gplx.dbs.*;
public class Xobc_step_map_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld_sm_id, fld_step_seqn, fld_task_id, fld_step_id;
private final Db_conn conn; private Db_stmt insert_stmt;
public Xobc_step_map_tbl(Db_conn conn) {
this.conn = conn;
this.tbl_name = "step_map";
this.fld_sm_id = flds.Add_int_pkey("sm_id");
this.fld_task_id = flds.Add_int("task_id");
this.fld_step_id = flds.Add_int("step_id");
this.fld_step_seqn = flds.Add_int("step_seqn");
this.fld_sm_id = flds.AddIntPkey("sm_id");
this.fld_task_id = flds.AddInt("task_id");
this.fld_step_id = flds.AddInt("step_id");
this.fld_step_seqn = flds.AddInt("step_seqn");
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;

View File

@@ -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.xowa.addons.bldrs.centrals.dbs.datas; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*; import gplx.xowa.addons.bldrs.centrals.dbs.*;
package gplx.xowa.addons.bldrs.centrals.dbs.datas; import gplx.*;
import gplx.dbs.*;
import gplx.xowa.addons.bldrs.centrals.cmds.*; import gplx.xowa.addons.bldrs.centrals.tasks.*;
public class Xobc_step_regy_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld_step_id, fld_step_type;
private final Db_conn conn; private Db_stmt insert_stmt;
public Xobc_step_regy_tbl(Db_conn conn) {
this.conn = conn;
this.tbl_name = "step_regy";
this.fld_step_id = flds.Add_int_pkey("step_id");
this.fld_step_type = flds.Add_int("step_type");
this.fld_step_id = flds.AddIntPkey("step_id");
this.fld_step_type = flds.AddInt("step_type");
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;

View File

@@ -13,21 +13,21 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.addons.bldrs.centrals.dbs.datas; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*; import gplx.xowa.addons.bldrs.centrals.dbs.*;
package gplx.xowa.addons.bldrs.centrals.dbs.datas; import gplx.*;
import gplx.dbs.*;
import gplx.xowa.addons.bldrs.centrals.cmds.*; import gplx.xowa.addons.bldrs.centrals.tasks.*;
import gplx.xowa.addons.bldrs.centrals.tasks.*;
public class Xobc_task_regy_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld_task_id, fld_task_seqn, fld_step_count, fld_task_key, fld_task_name;
private final Db_conn conn; private Db_stmt insert_stmt;
public Xobc_task_regy_tbl(Db_conn conn) {
this.conn = conn;
this.tbl_name = "task_regy";
this.fld_task_id = flds.Add_int_pkey("task_id");
this.fld_task_seqn = flds.Add_int("task_seqn");
this.fld_step_count = flds.Add_int("step_count");
this.fld_task_key = flds.Add_str("task_key", 255);
this.fld_task_name = flds.Add_str("task_name", 255);
this.fld_task_id = flds.AddIntPkey("task_id");
this.fld_task_seqn = flds.AddInt("task_seqn");
this.fld_step_count = flds.AddInt("step_count");
this.fld_task_key = flds.AddStr("task_key", 255);
this.fld_task_name = flds.AddStr("task_name", 255);
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;
@@ -87,7 +87,7 @@ public class Xobc_task_regy_tbl implements Db_tbl {
));
}
} finally {rdr.Rls();}
return (Xobc_task_regy_itm[])list.To_ary_and_clear(Xobc_task_regy_itm.class);
return (Xobc_task_regy_itm[])list.ToAryAndClear(Xobc_task_regy_itm.class);
}
public void Delete(int task_id) {
conn.Stmt_delete(tbl_name, fld_task_id).Crt_int(fld_task_id, task_id).Exec_delete();

View File

@@ -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.xowa.addons.bldrs.centrals.dbs.datas; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*; import gplx.xowa.addons.bldrs.centrals.dbs.*;
package gplx.xowa.addons.bldrs.centrals.dbs.datas; import gplx.*;
import gplx.dbs.*;
public class Xobc_version_regy_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld_version_id, fld_version_date, fld_version_note;
private final Db_conn conn;
public Xobc_version_regy_tbl(Db_conn conn) {
this.conn = conn;
this.tbl_name = "version_regy";
this.fld_version_id = flds.Add_int_pkey("version_id");
this.fld_version_date = flds.Add_str("version_date", 16);
this.fld_version_note = flds.Add_str("version_note", 255);
this.fld_version_id = flds.AddIntPkey("version_id");
this.fld_version_date = flds.AddStr("version_date", 16);
this.fld_version_note = flds.AddStr("version_note", 255);
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;

View File

@@ -13,27 +13,28 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.addons.bldrs.centrals.dbs.datas.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*; import gplx.xowa.addons.bldrs.centrals.dbs.*; import gplx.xowa.addons.bldrs.centrals.dbs.datas.*;
package gplx.xowa.addons.bldrs.centrals.dbs.datas.imports; import gplx.*;
import gplx.xowa.addons.bldrs.centrals.dbs.*; import gplx.xowa.addons.bldrs.centrals.dbs.datas.*;
import gplx.dbs.*;
public class Xobc_import_step_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld_step_id, fld_host_id, fld_wiki_abrv, fld_wiki_date, fld_import_name, fld_import_type, fld_import_zip, fld_import_md5, fld_import_size_zip, fld_import_size_raw, fld_prog_size_end, fld_prog_count_end;
public final Db_conn conn; private Db_stmt insert_stmt;
public Xobc_import_step_tbl(Db_conn conn) {
this.conn = conn;
this.tbl_name = "import_step";
this.fld_step_id = flds.Add_int_pkey("step_id");
this.fld_host_id = flds.Add_int("host_id");
this.fld_wiki_abrv = flds.Add_str("wiki_abrv", 255);
this.fld_wiki_date = flds.Add_str("wiki_date", 8);
this.fld_import_name = flds.Add_str("import_name", 255);
this.fld_import_type = flds.Add_int("import_type");
this.fld_import_zip = flds.Add_byte("import_zip");
this.fld_import_size_zip = flds.Add_long("import_size_zip");
this.fld_import_size_raw = flds.Add_long("import_size_raw");
this.fld_import_md5 = flds.Add_str("import_md5", 48);
this.fld_prog_size_end = flds.Add_long("prog_size_end");
this.fld_prog_count_end = flds.Add_long("prog_count_end");
this.fld_step_id = flds.AddIntPkey("step_id");
this.fld_host_id = flds.AddInt("host_id");
this.fld_wiki_abrv = flds.AddStr("wiki_abrv", 255);
this.fld_wiki_date = flds.AddStr("wiki_date", 8);
this.fld_import_name = flds.AddStr("import_name", 255);
this.fld_import_type = flds.AddInt("import_type");
this.fld_import_zip = flds.AddByte("import_zip");
this.fld_import_size_zip = flds.AddLong("import_size_zip");
this.fld_import_size_raw = flds.AddLong("import_size_raw");
this.fld_import_md5 = flds.AddStr("import_md5", 48);
this.fld_prog_size_end = flds.AddLong("prog_size_end");
this.fld_prog_count_end = flds.AddLong("prog_count_end");
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;
@@ -94,7 +95,7 @@ public class Xobc_import_step_tbl implements Db_tbl {
list.Add(New_itm(rdr));
}
} finally {rdr.Rls();}
return (Xobc_import_step_itm[])list.To_ary_and_clear(Xobc_import_step_itm.class);
return (Xobc_import_step_itm[])list.ToAryAndClear(Xobc_import_step_itm.class);
}
public void Rls() {
insert_stmt = Db_stmt_.Rls(insert_stmt);

View File

@@ -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.xowa.addons.bldrs.centrals.dbs.users; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*; import gplx.xowa.addons.bldrs.centrals.dbs.*;
package gplx.xowa.addons.bldrs.centrals.dbs.users; import gplx.*;
import gplx.dbs.*;
import gplx.xowa.addons.bldrs.centrals.cmds.*; import gplx.xowa.addons.bldrs.centrals.tasks.*;
public class Xobc_done_step_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld_task_id, fld_step_id;
private final Db_conn conn;
public Xobc_done_step_tbl(Db_conn conn) {
this.conn = conn;
this.tbl_name = "xobc_done_step";
this.fld_task_id = flds.Add_int("task_id");
this.fld_step_id = flds.Add_int("step_id");
this.fld_task_id = flds.AddInt("task_id");
this.fld_step_id = flds.AddInt("step_id");
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;
@@ -43,7 +42,7 @@ public class Xobc_done_step_tbl implements Db_tbl {
try {
if (rdr.Move_next()) {
if (rv == null) rv = Hash_adp_.New();
rv.Add_as_key_and_val(rdr.Read_int("step_id"));
rv.AddAsKeyAndVal(rdr.Read_int("step_id"));
}
}
finally {rdr.Rls();}

View File

@@ -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.xowa.addons.bldrs.centrals.dbs.users; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*; import gplx.xowa.addons.bldrs.centrals.dbs.*;
package gplx.xowa.addons.bldrs.centrals.dbs.users; import gplx.*;
import gplx.dbs.*;
import gplx.xowa.addons.bldrs.centrals.cmds.*; import gplx.xowa.addons.bldrs.centrals.tasks.*;
import gplx.xowa.addons.bldrs.centrals.tasks.*;
public class Xobc_done_task_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld_task_id, fld_task_seqn;
private final Db_conn conn;
public Xobc_done_task_tbl(Db_conn conn) {
this.conn = conn;
this.tbl_name = "xobc_done_task";
this.fld_task_id = flds.Add_int_pkey("task_id");
this.fld_task_seqn = flds.Add_int("task_seqn");
this.fld_task_id = flds.AddIntPkey("task_id");
this.fld_task_seqn = flds.AddInt("task_seqn");
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;

View File

@@ -13,20 +13,21 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.addons.bldrs.centrals.dbs.users; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*; import gplx.xowa.addons.bldrs.centrals.dbs.*;
package gplx.xowa.addons.bldrs.centrals.dbs.users; import gplx.*;
import gplx.xowa.addons.bldrs.centrals.*;
import gplx.dbs.*;
import gplx.xowa.addons.bldrs.centrals.cmds.*; import gplx.xowa.addons.bldrs.centrals.tasks.*;
public class Xobc_work_task_tbl implements Db_tbl {
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final DbmetaFldList flds = new DbmetaFldList();
private final String fld_task_id, fld_task_seqn, fld_step_id, fld_cmd_id;
private final Db_conn conn;
public Xobc_work_task_tbl(Db_conn conn) {
this.conn = conn;
this.tbl_name = "xobc_work_task";
this.fld_task_id = flds.Add_int_pkey("task_id");
this.fld_task_seqn = flds.Add_int("task_seqn");
this.fld_step_id = flds.Add_int("step_id");
this.fld_cmd_id = flds.Add_int("cmd_id");
this.fld_task_id = flds.AddIntPkey("task_id");
this.fld_task_seqn = flds.AddInt("task_seqn");
this.fld_step_id = flds.AddInt("step_id");
this.fld_cmd_id = flds.AddInt("cmd_id");
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;} private final String tbl_name;

View File

@@ -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.xowa.addons.bldrs.centrals.hosts; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*;
package gplx.xowa.addons.bldrs.centrals.hosts; import gplx.*;
import gplx.xowa.addons.bldrs.centrals.dbs.*; import gplx.xowa.addons.bldrs.centrals.dbs.datas.*;
import gplx.core.brys.evals.*;
import gplx.xowa.wikis.domains.*;
@@ -32,7 +32,7 @@ public class Host_eval_itm {
return Eval_src_dir(data_db, host_id, domain) + file_name;
}
public String Eval_src_dir(Xobc_data_db data_db, int host_id, Xow_domain_itm domain) {
Xobc_host_regy_itm host_itm = (Xobc_host_regy_itm)host_hash.Get_by(host_id);
Xobc_host_regy_itm host_itm = (Xobc_host_regy_itm)host_hash.GetByOrNull(host_id);
if (host_itm == null) {
host_itm = data_db.Tbl__host_regy().Select(host_id);
host_hash.Add(host_id, host_itm);

Some files were not shown because too many files have changed in this diff Show More