1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2015-08-30 22:57:59 -04:00
parent ed911e3de5
commit 5fc4eb41ec
579 changed files with 2460 additions and 1564 deletions

View File

@@ -27,7 +27,7 @@ public class Bry_rdr {
public void Pos_add(int v) {pos += v;}
public boolean Pos_is_eos() {return pos == src_len;}
public void Pos_add_one() {++pos;}
public int Or_int() {return or_int;} public void Or_int_(int v) {or_int = v;} private int or_int = Int_.MinValue;
public int Or_int() {return or_int;} public void Or_int_(int v) {or_int = v;} private int or_int = Int_.Min_value;
public byte[] Or_bry() {return or_bry;} public void Or_bry_(byte[] v) {or_bry = v;} private byte[] or_bry;
public int Find_fwd(byte find) {return Bry_finder.Find_fwd(src, find, pos);}
public int Find_fwd_ws() {return Bry_finder.Find_fwd_until_ws(src, pos, src_len);}
@@ -99,7 +99,7 @@ public class Bry_rdr {
public double Read_double_to_pipe() {return Read_double_to(Byte_ascii.Pipe);}
public double Read_double_to(byte to_char) {
byte[] double_bry = Read_bry_to(to_char);
return Double_.parse_(String_.new_a7(double_bry)); // double will never have utf8
return Double_.parse(String_.new_a7(double_bry)); // double will never have utf8
}
@gplx.Virtual public Bry_rdr Skip_ws() {
while (pos < src_len) {

View File

@@ -41,6 +41,7 @@ public class Btrie_slim_mgr implements Btrie_mgr {
}
}
public Btrie_slim_mgr Add_bry_tid(byte[] bry, byte tid) {return (Btrie_slim_mgr)Add_obj(bry, Byte_obj_val.new_(tid));}
public Btrie_slim_mgr Add_bry_int(byte[] key, int val) {return (Btrie_slim_mgr)Add_obj(key, Int_obj_val.new_(val));}
public Btrie_slim_mgr Add_str_byte(String key, byte val) {return (Btrie_slim_mgr)Add_obj(Bry_.new_u8(key), Byte_obj_val.new_(val));}
public Btrie_slim_mgr Add_str_int(String key, int val) {return (Btrie_slim_mgr)Add_obj(Bry_.new_u8(key), Int_obj_val.new_(val));}
public Btrie_slim_mgr Add_bry(String key, String val) {return (Btrie_slim_mgr)Add_obj(Bry_.new_u8(key), Bry_.new_u8(val));}
@@ -55,11 +56,12 @@ public class Btrie_slim_mgr implements Btrie_mgr {
Add_obj(Bry_.new_u8(ary[i]), bval);
return this;
}
public Btrie_slim_mgr Add_many_int(int val, String... ary) {
public Btrie_slim_mgr Add_many_int(int val, String... ary) {return Add_many_int(val, Bry_.Ary(ary));}
public Btrie_slim_mgr Add_many_int(int val, byte[]... ary) {
int len = ary.length;
Int_obj_val obj = Int_obj_val.new_(val);
for (int i = 0; i < len; i++)
Add_obj(Bry_.new_u8(ary[i]), obj);
Add_obj(ary[i], obj);
return this;
}
public Btrie_slim_mgr Add_stub(String key, byte val) {byte[] bry = Bry_.new_u8(key); return (Btrie_slim_mgr)Add_obj(bry, new Btrie_itm_stub(val, bry));}

View File

@@ -47,7 +47,7 @@ public class Criteria_ {
public static Criteria mte_(Comparable val) {return new Criteria_comp(CompareAble_.MoreOrSame, val);}
public static Criteria between_(Comparable lhs, Comparable rhs) {return new Criteria_between(false, lhs, rhs);}
public static Criteria between_(boolean negated, Comparable lhs, Comparable rhs) {return new Criteria_between(negated, lhs, rhs);}
public static Criteria like_(String pattern) {return new Criteria_like(false, RegxPatn_cls_like_.parse_(pattern, RegxPatn_cls_like.EscapeDefault));}
public static Criteria liken_(String pattern) {return new Criteria_like(true, RegxPatn_cls_like_.parse_(pattern, RegxPatn_cls_like.EscapeDefault));}
public static Criteria like_(String pattern) {return new Criteria_like(false, RegxPatn_cls_like_.parse(pattern, RegxPatn_cls_like.EscapeDefault));}
public static Criteria liken_(String pattern) {return new Criteria_like(true, RegxPatn_cls_like_.parse(pattern, RegxPatn_cls_like.EscapeDefault));}
public static final byte Tid_custom = 0, Tid_const = 1, Tid_not = 2, Tid_and = 3, Tid_or = 4, Tid_eq = 5, Tid_between = 6, Tid_in = 7, Tid_like = 8, Tid_comp = 9, Tid_wrapper = 10, Tid_iomatch = 11, Tid_db_obj_ary = 12;
}

View File

@@ -44,7 +44,7 @@ class Criteria_const implements Criteria {
public boolean Matches(Object comp) {return val;} private final boolean val;
public void Val_from_args(Hash_adp args) {;}
public void Val_as_obj_(Object v) {throw Err_.new_unimplemented();}
public String To_str() {return String_.Concat(" IS ", Bool_.Xto_str_lower(val));}
public String To_str() {return String_.Concat(" IS ", Bool_.To_str_lower(val));}
}
class Criteria_not implements Criteria {
private final Criteria criteria;

View File

@@ -37,7 +37,7 @@ public class Criteria_ioItm_tst {
tst_Match(false, crt, fil.ModifiedTime_(DateAdp_.parse_gplx("2000-12-31")));
}
@Test public void IoMatch() {
Criteria crt = Criteria_ioMatch.parse_(true, "*.txt", false);
Criteria crt = Criteria_ioMatch.parse(true, "*.txt", false);
CriteriaFxt fx_crt = new CriteriaFxt();
fx_crt.tst_Matches(crt, Io_url_.new_any_("file.txt"));
fx_crt.tst_MatchesNot(crt, Io_url_.new_any_("file.xml"));

View File

@@ -33,5 +33,5 @@ public class Criteria_ioMatch implements Criteria { // EX: url IOMATCH '*.xml|*.
public static final String TokenName = "IOMATCH";
public static Criteria_ioMatch as_(Object obj) {return obj instanceof Criteria_ioMatch ? (Criteria_ioMatch)obj : null;}
public static Criteria_ioMatch parse_(boolean match, String raw, boolean caseSensitive) {return new Criteria_ioMatch(match, RegxPatn_cls_ioMatch_.parse_(raw, caseSensitive));}
public static Criteria_ioMatch parse(boolean match, String raw, boolean caseSensitive) {return new Criteria_ioMatch(match, RegxPatn_cls_ioMatch_.parse(raw, caseSensitive));}
}

View File

@@ -25,7 +25,7 @@ public class Bool_obj_ref {
public Bool_obj_ref Val_n_() {val = false; return this;}
public Bool_obj_ref Val_(boolean v) {val = v; return this;}
public Bool_obj_ref Val_toggle_() {val = !val; return this;}
@Override public String toString() {return Bool_.Xto_str_lower(val);}
@Override public String toString() {return Bool_.To_str_lower(val);}
public static Bool_obj_ref n_() {return new_(false);}
public static Bool_obj_ref y_() {return new_(true);}
public static Bool_obj_ref new_(boolean val) {

View File

@@ -24,8 +24,8 @@ public class Bool_obj_val {
, False = new Bool_obj_val(0)
, True = new Bool_obj_val(1)
;
public static Bool_obj_val read_(Object o) {String s = String_.as_(o); return s == null ? (Bool_obj_val)o : parse_(s);}
public static Bool_obj_val parse_(String raw) {
public static Bool_obj_val read_(Object o) {String s = String_.as_(o); return s == null ? (Bool_obj_val)o : parse(s);}
public static Bool_obj_val parse(String raw) {
if (String_.Eq(raw, "y")) return Bool_obj_val.True;
else if (String_.Eq(raw, "n")) return Bool_obj_val.False;
else if (String_.Eq(raw, "")) return Bool_obj_val.Null;

View File

@@ -60,7 +60,7 @@ public class Regx_adp__tst implements TfdsEqListItmStr {
rv[i] = match_(bgnAry[i]);
return rv;
}
Regx_match match_(int bgn) {return match_(bgn, Int_.MinValue);}
Regx_match match_(int bgn) {return match_(bgn, Int_.Min_value);}
Regx_match match_(int bgn, int len) {return new Regx_match(true, bgn, bgn + len, Regx_group.Ary_empty);}
void tst_Matches(String find, String input, Regx_match... expd) {
List_adp expdList = Array_.XtoList(expd);
@@ -87,7 +87,7 @@ public class Regx_adp__tst implements TfdsEqListItmStr {
public String To_str(Object curObj, Object expdObj) {
Regx_match cur = (Regx_match)curObj, expd = (Regx_match)expdObj;
String rv = "bgn=" + cur.Find_bgn();
if (expd != null && expd.Find_len() != Int_.MinValue) rv += " len=" + cur.Find_len();
if (expd != null && expd.Find_len() != Int_.Min_value) rv += " len=" + cur.Find_len();
return rv;
}
}