mirror of https://github.com/gnosygnu/xowa
parent
55ea1fa39a
commit
bd6576b716
@ -0,0 +1,37 @@
|
||||
/*
|
||||
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.xowa.addons.bldrs.centrals; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*;
|
||||
import gplx.xowa.addons.bldrs.centrals.tasks.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.langs.*;
|
||||
public class Xobc_filter_mgr {
|
||||
public static Xobc_task_itm[] Filter_by_lang(Xobc_task_regy__base task_list, String lang_key_str) {
|
||||
List_adp tmp = List_adp_.New();
|
||||
|
||||
// loop tasks and find matches
|
||||
int len = task_list.Len();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Xobc_task_itm task = (Xobc_task_itm)task_list.Get_at(i);
|
||||
Xobc_task_key task_key_itm = Xobc_task_key.To_itm(task.Task_key());
|
||||
if (Xow_domain_itm_.Match_lang(task_key_itm.Wiki_domain_itm(), lang_key_str))
|
||||
tmp.Add(task);
|
||||
}
|
||||
|
||||
return (Xobc_task_itm[])tmp.To_ary_and_clear(Xobc_task_itm.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
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.xowa.addons.bldrs.centrals.tasks; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xobc_task_key {
|
||||
public Xobc_task_key(String wiki_domain, String wiki_date, String task_type) {
|
||||
this.wiki_domain = wiki_domain;
|
||||
this.wiki_date = wiki_date;
|
||||
this.task_type = task_type;
|
||||
}
|
||||
public String Wiki_domain() {return wiki_domain;} private final String wiki_domain;
|
||||
public String Wiki_date() {return wiki_date;} private final String wiki_date;
|
||||
public String Wiki_date_ui() {return String_.Replace(wiki_date, ".", "-");}
|
||||
public String Task_type() {return task_type;} private final String task_type;
|
||||
public String Task_type_ui() {
|
||||
if (String_.Eq(task_type, "html")) return "Articles";
|
||||
else if (String_.Eq(task_type, "file")) return "Images";
|
||||
else if (String_.Eq(task_type, "text")) return "Source";
|
||||
else if (String_.Eq(task_type, "patch")) return "Patch";
|
||||
else return task_type;
|
||||
}
|
||||
public Xow_domain_itm Wiki_domain_itm() {return Xow_domain_itm_.parse(Bry_.new_u8(wiki_domain));}
|
||||
|
||||
public static Xobc_task_key To_itm(String task_key) {
|
||||
String[] ary = String_.Split(task_key, "|");
|
||||
return new Xobc_task_key(ary[0], ary[1], ary[2]);
|
||||
}
|
||||
public static String To_str(String wiki_domain, String wiki_date, String task_type) {
|
||||
return String_.Concat(wiki_domain, "|", wiki_date, "|", task_type);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue