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

Refactor: Clean up Int_ classes

This commit is contained in:
gnosygnu
2017-10-22 08:07:00 -04:00
parent d270cce881
commit 3157551d1d
154 changed files with 609 additions and 577 deletions

View File

@@ -44,7 +44,7 @@ public class Gfs_nde {
subs[subs_len] = nde;
subs_len = new_len;
return this;
} Gfs_nde[] subs = Gfs_nde.Ary_empty; int subs_max; int[] subs_pos_ary = Int_.Ary_empty;
} Gfs_nde[] subs = Gfs_nde.Ary_empty; int subs_max; int[] subs_pos_ary = Int_ary_.Empty;
public Gfs_nde Subs_get_at(int i) {return subs[i];}
public Gfs_nde[] Subs_to_ary() {
Gfs_nde[] rv = new Gfs_nde[subs_len];
@@ -71,7 +71,7 @@ public class Gfs_nde {
args[args_len] = nde;
args_len = new_len;
return this;
} Gfs_nde[] args = Gfs_nde.Ary_empty; int args_max; int[] args_pos_ary = Int_.Ary_empty;
} Gfs_nde[] args = Gfs_nde.Ary_empty; int args_max; int[] args_pos_ary = Int_ary_.Empty;
public Gfs_nde[] Atrs_to_ary() {
Gfs_nde[] rv = new Gfs_nde[args_len];
for (int i = 0; i < args_len; i++)

View File

@@ -27,7 +27,7 @@ public class Gfh_nde {
}
}
public byte[] Src() {return src;} private byte[] src;
public int[] Atrs() {return atrs;} private int[] atrs = Int_.Ary_empty;
public int[] Atrs() {return atrs;} private int[] atrs = Int_ary_.Empty;
public int Atrs_len() {return atrs_len;} private int atrs_len;
public boolean Tag_tid_is_inline() {return tag_tid_is_inline;} private boolean tag_tid_is_inline;
public int Tag_lhs_bgn() {return tag_lhs_bgn;} public Gfh_nde Tag_lhs_bgn_(int v) {tag_lhs_bgn = v; return this;} private int tag_lhs_bgn;

View File

@@ -49,14 +49,14 @@ class Gfo_url_encoder_itm_hex implements Gfo_url_encoder_itm {
return 0;
}
}
int hex_val = Int_.To_int_hex(src[idx + 1]);
int hex_val = Int_.By_hex_byte(src[idx + 1]);
if (hex_val == -1) { // invalid hex byte; EX: %GC; DATE:2014-04-10
bfr.Add_byte(b);
return 0;
}
int v_0 = hex_val * 16;
if (v_0 != -1) {
int v_1 = Int_.To_int_hex(src[idx + 2]);
int v_1 = Int_.By_hex_byte(src[idx + 2]);
if (v_1 != -1) {
bfr.Add_byte((byte)(v_0 + v_1));
return 2;

View File

@@ -164,8 +164,8 @@ public class Json_wtr {
switch (type_tid) {
case Type_ids_.Id__null: bfr.Add(Object_.Bry__null); break;
case Type_ids_.Id__bool: bfr.Add_bool(Bool_.Cast(obj)); break;
case Type_ids_.Id__byte: bfr.Add_byte(Byte_.cast(obj)); break;
case Type_ids_.Id__int: bfr.Add_int_variable(Int_.cast(obj)); break;
case Type_ids_.Id__byte: bfr.Add_byte(Byte_.Cast(obj)); break;
case Type_ids_.Id__int: bfr.Add_int_variable(Int_.Cast(obj)); break;
case Type_ids_.Id__long: bfr.Add_long_variable(Long_.cast(obj)); break;
case Type_ids_.Id__float: bfr.Add_float(Float_.cast(obj)); break;
case Type_ids_.Id__double: bfr.Add_double(Double_.cast(obj)); break;

View File

@@ -40,7 +40,7 @@ public class Php_srl_parser {
val = Xto_kv_ary(ary);
break;
case Php_srl_itm_.Tid_function:
val = new gplx.xowa.xtns.scribunto.Scrib_lua_proc(Object_.Xto_str_strict_or_null_mark(key), Int_.cast(itm_val.Val())); // NOTE: in most cases, key is a STRING (name of ScribFunction); however, for gsub it is an INT (arg_idx) b/c it is passed as a parameter
val = new gplx.xowa.xtns.scribunto.Scrib_lua_proc(Object_.Xto_str_strict_or_null_mark(key), Int_.Cast(itm_val.Val())); // NOTE: in most cases, key is a STRING (name of ScribFunction); however, for gsub it is an INT (arg_idx) b/c it is passed as a parameter
break;
default:
val = itm_val.Val();

View File

@@ -119,11 +119,11 @@ public class Php_text_itm_parser {
}
if (txt_bgn != -1) {tmp_list.Add(new Php_text_itm_text(txt_bgn, raw_len)); txt_bgn = -1; rslt_val = Rslt_dirty;}
rslt.Val_(rslt_val);
} private static final byte[] CONST_utf_prefix = Bry_.new_a7("\\u00");
} private static final byte[] CONST_utf_prefix = Bry_.new_a7("\\u00");
private void Parse_utf16(List_adp rv, byte[] src, int bgn, int src_len) {
int end = bgn + 4;
if (end >= src_len) throw Err_.new_wo_type("utf16_parse", "src", String_.new_u8(src));
int v = Int_.To_int_hex(src, bgn, end); // +2; skip "\" + "u"
int v = Int_.By_hex_bry(src, bgn, end); // +2; skip "\" + "u"
byte[] literal = gplx.core.intls.Utf16_.Encode_int_to_bry(v);
rv.Add(new Php_text_itm_utf16(bgn, end, literal));
}