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-04-05 21:00:31 -04:00
parent 80b9928b5c
commit 18dcd3f89e
615 changed files with 9826 additions and 8619 deletions

View File

@@ -1,38 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
public class Io_fil implements gplx.CompareAble {
public Io_fil(Io_url url, String data) {this.url = url; this.data = data;}
public Io_url Url() {return url;} public Io_fil Url_(Io_url v) {url = v; return this;} Io_url url;
public String Data() {return data;} public Io_fil Data_(String v) {data = v; return this;} private String data;
public int compareTo(Object obj) {
return gplx.CompareAble_.Compare(url.Raw(), ((Io_fil)obj).Url().Raw());
}
public static Io_fil[] new_ary_(Io_url[] url_ary) {
int url_ary_len = url_ary.length;
Io_fil[] rv = new Io_fil[url_ary_len];
for (int i = 0; i < url_ary_len; i++) {
Io_url url = url_ary[i];
String data = Io_mgr._.LoadFilStr(url);
Io_fil fil = new Io_fil(url, data);
rv[i] = fil;
}
return rv;
}
public static final Io_fil[] Ary_empty = new Io_fil[0];
}

View File

@@ -50,7 +50,7 @@ class Io_sort_fxt {
public String GenRandom(int rows, int pad) {
ListAdp list = ListAdp_.new_();
for (int i = 0; i < rows; i++)
list.Add(Int_.Xto_str_pad_bgn(i, pad) + "|");
list.Add(Int_.Xto_str_pad_bgn_zero(i, pad) + "|");
list.Shuffle();
for (int i = 0; i < rows; i++) {
String itm = (String)list.FetchAt(i);
@@ -60,7 +60,7 @@ class Io_sort_fxt {
}
public String GenOrdered(int rows, int pad) {
for (int i = 0; i < rows; i++)
sb.Add(Int_.Xto_str_pad_bgn(i, pad) + "|" + "\n");
sb.Add(Int_.Xto_str_pad_bgn_zero(i, pad) + "|" + "\n");
return sb.Xto_str_and_clear();
}
}

View File

@@ -25,11 +25,11 @@ class Io_url_gen_dir implements Io_url_gen {
public String Fmt() {return fmt;} public Io_url_gen_dir Fmt_(String v) {fmt = v; return this;} private String fmt = "{0}.csv";
public int Fmt_digits() {return fmt_digits;} public Io_url_gen_dir Fmt_digits_(int v) {fmt_digits = v; return this;} private int fmt_digits = 10;
public Io_url Cur_url() {return cur_url;} Io_url cur_url;
public Io_url Nxt_url() {cur_url = dir.GenSubFil(String_.Format(fmt, Int_.Xto_str_pad_bgn(idx++, fmt_digits))); return cur_url;} private int idx = 0;
public Io_url Nxt_url() {cur_url = dir.GenSubFil(String_.Format(fmt, Int_.Xto_str_pad_bgn_zero(idx++, fmt_digits))); return cur_url;} private int idx = 0;
public Io_url[] Prv_urls() {
Io_url[] rv = new Io_url[idx];
for (int i = 0; i < idx; i++) {
rv[i] = dir.GenSubFil(String_.Format(fmt, Int_.Xto_str_pad_bgn(i, fmt_digits)));
rv[i] = dir.GenSubFil(String_.Format(fmt, Int_.Xto_str_pad_bgn_zero(i, fmt_digits)));
}
return rv;
}