mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.6.3.1'
This commit is contained in:
@@ -95,7 +95,7 @@ public class Xow_abrv_wm_ {
|
||||
}
|
||||
public static byte[] To_abrv(Xow_domain_itm domain_itm) {
|
||||
int tid = domain_itm.Domain_type_id();
|
||||
byte[] suffix = (byte[])int_hash.Get_by(Int_obj_ref.new_(tid)); if (suffix == null) return null;
|
||||
byte[] suffix = (byte[])int_hash.Get_by(Int_obj_ref.New(tid)); if (suffix == null) return null;
|
||||
switch (tid) {
|
||||
case Xow_domain_tid_.Int__commons:
|
||||
case Xow_domain_tid_.Int__species:
|
||||
@@ -116,10 +116,10 @@ public class Xow_abrv_wm_ {
|
||||
default: throw Err_.new_unhandled(tid);
|
||||
}
|
||||
}
|
||||
private static final Btrie_bwd_mgr bry_trie = Init_trie();
|
||||
private static final Btrie_bwd_mgr bry_trie = Init_trie();
|
||||
private static Hash_adp int_hash;
|
||||
private static Btrie_bwd_mgr Init_trie() {
|
||||
int_hash = Hash_adp_.new_();
|
||||
int_hash = Hash_adp_.New();
|
||||
Btrie_bwd_mgr rv = new Btrie_bwd_mgr(false);
|
||||
Init_trie_itm(rv, int_hash, "wiki" , Xow_domain_tid_.Int__wikipedia);
|
||||
Init_trie_itm(rv, int_hash, "wiktionary" , Xow_domain_tid_.Int__wiktionary);
|
||||
@@ -140,7 +140,7 @@ public class Xow_abrv_wm_ {
|
||||
return rv;
|
||||
}
|
||||
private static void Init_trie_itm(Btrie_bwd_mgr trie, Hash_adp hash, String str, int tid) {
|
||||
Int_obj_ref itm = Int_obj_ref.new_(tid);
|
||||
Int_obj_ref itm = Int_obj_ref.New(tid);
|
||||
trie.Add(str, itm);
|
||||
hash.Add(itm, Bry_.new_u8(str));
|
||||
}
|
||||
@@ -154,7 +154,7 @@ class Xow_abrv_wm_override {
|
||||
Object o = lang_hash.Get_by_bry(domain_bry);
|
||||
return o == null ? null : (byte[])o;
|
||||
}
|
||||
private static final Hash_adp_bry itm_hash = itm_hash__make();
|
||||
private static final Hash_adp_bry itm_hash = itm_hash__make();
|
||||
private static Hash_adp_bry lang_hash;
|
||||
private static Hash_adp_bry itm_hash__make() {
|
||||
Hash_adp_bry rv = Hash_adp_bry.cs();
|
||||
|
||||
@@ -81,8 +81,8 @@ class Xow_abrv_wm_fxt {
|
||||
Tfds.Eq(expd, String_.new_a7(actl));
|
||||
}
|
||||
public void Test_to_abrv_by_lang(String lang_key, int wiki_tid, String expd) {
|
||||
Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
Xow_abrv_wm_.To_abrv(tmp_bfr, Bry_.new_a7(lang_key), gplx.core.primitives.Int_obj_ref.new_(wiki_tid));
|
||||
Bry_bfr tmp_bfr = Bry_bfr_.Reset(255);
|
||||
Xow_abrv_wm_.To_abrv(tmp_bfr, Bry_.new_a7(lang_key), gplx.core.primitives.Int_obj_ref.New(wiki_tid));
|
||||
Tfds.Eq_str(expd, tmp_bfr.To_str_and_clear(), "to_abrv");
|
||||
}
|
||||
public void Test_to_domain_bry(String wmf_key, String expd_domain) {
|
||||
|
||||
@@ -44,11 +44,11 @@ public class Xow_domain_uid_ {
|
||||
public static int To_int(Xow_domain_itm domain) {
|
||||
int domain_tid = 0;
|
||||
switch (domain.Domain_type_id()) {
|
||||
case Xow_domain_tid_.Int__home: return Tid_xowa;
|
||||
case Xow_domain_tid_.Int__home: return Tid_xowa;
|
||||
case Xow_domain_tid_.Int__commons: return Tid_commons;
|
||||
case Xow_domain_tid_.Int__wikidata: return Tid_wikidata;
|
||||
case Xow_domain_tid_.Int__wikidata: return Tid_wikidata;
|
||||
case Xow_domain_tid_.Int__mediawiki: return Tid_mediawiki;
|
||||
case Xow_domain_tid_.Int__meta: return Tid_meta;
|
||||
case Xow_domain_tid_.Int__meta: return Tid_meta;
|
||||
case Xow_domain_tid_.Int__incubator: return Tid_incubator;
|
||||
case Xow_domain_tid_.Int__wmfblog: return Tid_wmfblog;
|
||||
case Xow_domain_tid_.Int__species: return Tid_species;
|
||||
@@ -59,7 +59,7 @@ public class Xow_domain_uid_ {
|
||||
case Xow_domain_tid_.Int__wikiquote: domain_tid = Tid_sub_wikiquote; break;
|
||||
case Xow_domain_tid_.Int__wikibooks: domain_tid = Tid_sub_wikibooks; break;
|
||||
case Xow_domain_tid_.Int__wikiversity: domain_tid = Tid_sub_wikiversity; break;
|
||||
case Xow_domain_tid_.Int__wikinews: domain_tid = Tid_sub_wikinews; break;
|
||||
case Xow_domain_tid_.Int__wikinews: domain_tid = Tid_sub_wikinews; break;
|
||||
case Xow_domain_tid_.Int__wikimedia: domain_tid = Tid_sub_wikimedia; break;
|
||||
default: throw Err_.new_unhandled(domain.Domain_type_id());
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class Xow_domain_crt_itm_parser {
|
||||
return rv == null ? null : (Xow_domain_crt_kv_ary[])rv.To_ary_and_clear(Xow_domain_crt_kv_ary.class);
|
||||
}
|
||||
public List_adp Parse_as_obj_or_null(byte[] raw, boolean is_ary) {
|
||||
List_adp rv = List_adp_.new_();
|
||||
List_adp rv = List_adp_.New();
|
||||
byte[][] line_ary = Bry_split_.Split_lines(raw);
|
||||
int line_len = line_ary.length;
|
||||
for (int i = 0; i < line_len; ++i) {
|
||||
@@ -80,12 +80,12 @@ class Xow_domain_crt_itm_parser {
|
||||
else
|
||||
return new Xow_domain_crt_itm__wiki(raw); // EX: en.wikipedia.org
|
||||
}
|
||||
private static final Hash_adp_bry itm_hash = Hash_adp_bry.cs()
|
||||
private static final Hash_adp_bry itm_hash = Hash_adp_bry.cs()
|
||||
.Add_str_obj("<self>" , Xow_domain_crt_itm__self.Instance)
|
||||
.Add_str_obj("<same_type>" , Xow_domain_crt_itm__same_type.Instance)
|
||||
.Add_str_obj("<same_lang>" , Xow_domain_crt_itm__same_lang.Instance)
|
||||
.Add_str_obj("<any>" , Xow_domain_crt_itm__any_wiki.Instance)
|
||||
;
|
||||
private static final byte[] Wild_lang = Bry_.new_a7("*."), Wild_type = Bry_.new_a7(".*");
|
||||
public static final Xow_domain_crt_itm_parser Instance = new Xow_domain_crt_itm_parser(); Xow_domain_crt_itm_parser() {}
|
||||
private static final byte[] Wild_lang = Bry_.new_a7("*."), Wild_type = Bry_.new_a7(".*");
|
||||
public static final Xow_domain_crt_itm_parser Instance = new Xow_domain_crt_itm_parser(); Xow_domain_crt_itm_parser() {}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.domains.crts; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*;
|
||||
public class Xow_domain_crt_kv_itm_mgr {
|
||||
private final List_adp list = List_adp_.new_();
|
||||
private final List_adp list = List_adp_.New();
|
||||
public void Clear() {list.Clear();}
|
||||
@gplx.Internal protected void Add(Xow_domain_crt_kv_itm itm) {list.Add(itm);}
|
||||
public boolean Parse_as_itms(byte[] raw) {
|
||||
@@ -57,11 +57,11 @@ public class Xow_domain_crt_kv_itm_mgr {
|
||||
}
|
||||
class Xow_domain_crt_kv_itm {
|
||||
public Xow_domain_crt_kv_itm(Xow_domain_crt_itm key, Xow_domain_crt_itm val) {this.key = key; this.val = val;}
|
||||
public Xow_domain_crt_itm Key() {return key;} private final Xow_domain_crt_itm key;
|
||||
public Xow_domain_crt_itm Val() {return val;} private final Xow_domain_crt_itm val;
|
||||
public Xow_domain_crt_itm Key() {return key;} private final Xow_domain_crt_itm key;
|
||||
public Xow_domain_crt_itm Val() {return val;} private final Xow_domain_crt_itm val;
|
||||
}
|
||||
class Xow_domain_crt_kv_ary {
|
||||
public Xow_domain_crt_kv_ary(Xow_domain_crt_itm key, Xow_domain_crt_itm[] val) {this.key = key; this.val = val;}
|
||||
public Xow_domain_crt_itm Key() {return key;} private final Xow_domain_crt_itm key;
|
||||
public Xow_domain_crt_itm[] Val() {return val;} private final Xow_domain_crt_itm[] val;
|
||||
public Xow_domain_crt_itm Key() {return key;} private final Xow_domain_crt_itm key;
|
||||
public Xow_domain_crt_itm[] Val() {return val;} private final Xow_domain_crt_itm[] val;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user