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
2014-07-28 01:40:51 -04:00
parent e882217c62
commit 7b6e65b088
247 changed files with 2985 additions and 1618 deletions

View File

@@ -120,10 +120,12 @@ public class Bry_bfr {
return this;
}
public Bry_bfr Add_byte_eq() {return Add_byte(Byte_ascii.Eq);}
public Bry_bfr Add_byte_pipe() {return Add_byte(Byte_ascii.Pipe);}
public Bry_bfr Add_byte_apos() {return Add_byte(Byte_ascii.Apos);}
public Bry_bfr Add_byte_quote() {return Add_byte(Byte_ascii.Quote);}
public Bry_bfr Add_byte_space() {return Add_byte(Byte_ascii.Space);}
public Bry_bfr Add_byte_pipe() {return Add_byte(Byte_ascii.Pipe);}
public Bry_bfr Add_byte_comma() {return Add_byte(Byte_ascii.Comma);}
public Bry_bfr Add_byte_apos() {return Add_byte(Byte_ascii.Apos);}
public Bry_bfr Add_byte_backslash() {return Add_byte(Byte_ascii.Backslash);}
public Bry_bfr Add_byte_quote() {return Add_byte(Byte_ascii.Quote);}
public Bry_bfr Add_byte_space() {return Add_byte(Byte_ascii.Space);}
public Bry_bfr Add_byte_nl() {return Add_byte(Byte_ascii.NewLine);}
public Bry_bfr Add_byte(byte val) {
int newPos = bfr_len + 1;

View File

@@ -100,6 +100,16 @@ public class Bry_finder {
}
return rv;
}
public static int Find_bwd_ws(byte[] src, int cur, int end) {
for (int i = cur; i > -1; --i) {
byte b = src[i];
switch (b) {
case Byte_ascii.Space: case Byte_ascii.Tab: case Byte_ascii.NewLine: case Byte_ascii.CarriageReturn:
return i;
}
}
return Bry_finder.Not_found;
}
public static int Find_fwd_last_ws(byte[] src, int cur) {
int end = src.length;
if (cur >= end) return Bry_finder.Not_found;
@@ -165,6 +175,18 @@ public class Bry_finder {
cur++;
}
}
public static int Find_fwd_until_space_or_tab(byte[] src, int cur, int end) {
while (true) {
if (cur == end) return Bry_finder.Not_found;
switch (src[cur]) {
case Byte_ascii.Space: case Byte_ascii.Tab:
return cur;
default:
++cur;
break;
}
}
}
public static int Find_fwd_while_space_or_tab(byte[] src, int cur, int end) {
while (true) {
if (cur == end) return cur;

View File

@@ -76,7 +76,9 @@ public class Byte_ascii {
, Lt_bry = new byte[] {Byte_ascii.Lt}
, Gt_bry = new byte[] {Byte_ascii.Gt}
, Brack_bgn_bry = new byte[] {Byte_ascii.Brack_bgn}
, Brack_end_bry = new byte[] {Byte_ascii.Brack_end}
, Apos_bry = new byte[] {Byte_ascii.Apos}
, Quote_bry = new byte[] {Byte_ascii.Quote}
, Pipe_bry = new byte[] {Byte_ascii.Pipe}
, Underline_bry = new byte[] {Byte_ascii.Underline}
, Asterisk_bry = new byte[] {Byte_ascii.Asterisk}

View File

@@ -43,6 +43,7 @@ public class Int_ implements GfoInvkAble {
rv[i] = bgn + i;
return rv;
}
public static boolean Bounds_chk(int bgn, int end, int len) {return bgn > -1 && end < len;}
public static final int
MinValue = Integer.MIN_VALUE
, MaxValue = Integer.MAX_VALUE

View File

@@ -152,7 +152,7 @@ public class String_ implements GfoInvkAble {
rv[i] = (int)s.charAt(i);
return rv;
}
public static String Coalesce(String s, String alt) {return Len(s) == 0 ? alt : s;}
public static String Coalesce(String s, String alt) {return Len_eq_0(s) ? alt : s;}
public static boolean In(String s, String... ary) {
for (String itm : ary)
if (String_.Eq(s, itm)) return true;