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

Cldr: Add initial support for cldr

This commit is contained in:
gnosygnu
2018-08-05 21:21:40 -04:00
parent be3979c5af
commit e78382a8ac
27 changed files with 1052 additions and 99 deletions

View File

@@ -372,8 +372,9 @@ public class Bry_bfr {
}
public Bry_bfr Add_float(float f) {Add_str_a7(Float_.To_str(f)); return this;}
public Bry_bfr Add_double(double v) {Add_str_a7(Double_.To_str(v)); return this;}
public Bry_bfr Add_dte(DateAdp val) {return Add_dte_segs(val.Year(), val.Month(),val.Day(), val.Hour(), val.Minute(), val.Second(), val.Frac());}
public Bry_bfr Add_dte_segs(int y, int M, int d, int H, int m, int s, int f) { // yyyyMMdd HHmmss.fff
public Bry_bfr Add_dte(DateAdp val) {return Add_dte_segs(Byte_ascii.Space , val.Year(), val.Month(),val.Day(), val.Hour(), val.Minute(), val.Second(), val.Frac());}
public Bry_bfr Add_dte_under(DateAdp val) {return Add_dte_segs(Byte_ascii.Underline, val.Year(), val.Month(),val.Day(), val.Hour(), val.Minute(), val.Second(), val.Frac());}
private Bry_bfr Add_dte_segs(byte spr, int y, int M, int d, int H, int m, int s, int f) { // yyyyMMdd HHmmss.fff
if (bfr_len + 19 > bfr_max) Resize((bfr_len + 19) * 2);
bfr[bfr_len + 0] = (byte)((y / 1000) + Bry_.Ascii_zero); y %= 1000;
bfr[bfr_len + 1] = (byte)((y / 100) + Bry_.Ascii_zero); y %= 100;
@@ -383,7 +384,7 @@ public class Bry_bfr {
bfr[bfr_len + 5] = (byte)( M + Bry_.Ascii_zero);
bfr[bfr_len + 6] = (byte)((d / 10) + Bry_.Ascii_zero); d %= 10;
bfr[bfr_len + 7] = (byte)( d + Bry_.Ascii_zero);
bfr[bfr_len + 8] = Byte_ascii.Space;
bfr[bfr_len + 8] = spr;
bfr[bfr_len + 9] = (byte)((H / 10) + Bry_.Ascii_zero); H %= 10;
bfr[bfr_len + 10] = (byte)( H + Bry_.Ascii_zero);
bfr[bfr_len + 11] = (byte)((m / 10) + Bry_.Ascii_zero); m %= 10;

View File

@@ -16,8 +16,9 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
package gplx.core.envs; import gplx.*; import gplx.core.*;
public class System_ {
// *** ticks
public static final int Ticks__per_second = 1000;
public static long Ticks() {return Ticks__test_val >= 0 ? Ticks__test_val : System.currentTimeMillis();}
public static int Ticks__elapsed_in_sec (long time_bgn) {return (int)(Ticks() - time_bgn) / 1000;}
public static int Ticks__elapsed_in_sec (long time_bgn) {return (int)(Ticks() - time_bgn) / Ticks__per_second;}
public static int Ticks__elapsed_in_frac (long time_bgn) {return (int)(Ticks() - time_bgn);}
public static void Ticks__test_set(long v) {Ticks__test_val = v;}
public static void Ticks__test_add(long v) {Ticks__test_val += v;}

View File

@@ -0,0 +1,58 @@
/*
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.lists; import gplx.*; import gplx.core.*;
public class Sorted_hash implements Hash_adp {
public Sorted_hash() {this.hash = new java.util.TreeMap();}
public Sorted_hash(ComparerAble comparer) {this.hash = new java.util.TreeMap(comparer);}
public boolean Has(Object key) {return Has_base(key);}
public Object Get_by(Object key) {return Fetch_base(key);}
public Object Get_by_or_fail(Object key) {return Get_by_or_fail_base(key);}
public void Add(Object key, Object val) {Add_base(key, val);}
public Hash_adp Add_and_more(Object key, Object val) {Add_base(key, val); return this;}
public void Add_as_key_and_val(Object val) {Add_base(val, val);}
public void Add_if_dupe_use_nth(Object key, Object val) {
Object existing = Fetch_base(key); if (existing != null) Del(key); // overwrite if exists
Add(key, val);
}
public boolean Add_if_dupe_use_1st(Object key, Object val) {
if (Has(key)) return false;
Add(key, val);
return true;
}
public void Del(Object key) {Del_base(key);}
protected Object Get_by_or_fail_base(Object key) {
if (key == null) throw Err_.new_wo_type("key cannot be null");
if (!Has_base(key)) throw Err_.new_wo_type("key not found", "key", key);
return Fetch_base(key);
}
public Object[] Values_array() {
return hash.values().toArray();
}
public Object Del_val_at_0() {
return hash.pollFirstEntry().getValue();
}
private final java.util.TreeMap hash;
public int Len() {return hash.size();}
public int Count() {return hash.size();}
public void Clear() {hash.clear();}
private void Add_base(Object key, Object val) {hash.put(key, val);}
private void Del_base(Object key) {hash.remove(key);}
private boolean Has_base(Object key) {return hash.containsKey(key);}
private Object Fetch_base(Object key) {return hash.get(key);}
public Object Get_val_at_0() {return hash.firstEntry().getValue();}
public java.util.Iterator iterator() {return hash.values().iterator();}
}