mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.10.3.1
This commit is contained in:
@@ -17,5 +17,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.langs.plurals; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
|
||||
public interface Xol_plural {
|
||||
byte[] Plural_eval(Xol_lang lang, int count, byte[][] words);
|
||||
byte[] Plural_eval(Xol_lang_itm lang, int count, byte[][] words);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ package gplx.xowa.langs.plurals; import gplx.*; import gplx.xowa.*; import gplx.
|
||||
public class Xol_plural_ {
|
||||
public static Xol_plural new_by_lang_id(int lang_id) {
|
||||
switch (lang_id) {
|
||||
case Xol_lang_itm_.Id_ru: return Xol_plural_ru._;
|
||||
default: return Xol_plural__default._;
|
||||
case Xol_lang_stub_.Id_ru: return Xol_plural_ru.Instance;
|
||||
default: return Xol_plural__default.Instance;
|
||||
}
|
||||
}
|
||||
public static byte[][] Fill_ary(byte[][] words, int words_len, int reqd_len) {// convert words to an ary of at least reqd_len where new entries are filled with last item; EX: {"a", "b"}, 3 -> {"a", "b", "b"}
|
||||
@@ -32,7 +32,7 @@ public class Xol_plural_ {
|
||||
}
|
||||
}
|
||||
class Xol_plural__default implements Xol_plural {
|
||||
public byte[] Plural_eval(Xol_lang lang, int count, byte[][] forms) {
|
||||
public byte[] Plural_eval(Xol_lang_itm lang, int count, byte[][] forms) {
|
||||
int forms_len = forms.length;
|
||||
switch (forms_len) {
|
||||
case 0: return Bry_.Empty; // forms is empty; do nothing
|
||||
@@ -40,5 +40,5 @@ class Xol_plural__default implements Xol_plural {
|
||||
default: return count == 1 ? forms[0] : forms[1]; // TODO: incorporate plurals.xml logic
|
||||
}
|
||||
}
|
||||
public static final Xol_plural__default _ = new Xol_plural__default(); Xol_plural__default() {}
|
||||
public static final Xol_plural__default Instance = new Xol_plural__default(); Xol_plural__default() {}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.langs.plurals; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
|
||||
public class Xol_plural_ru implements Xol_plural {
|
||||
public byte[] Plural_eval(Xol_lang lang, int count, byte[][] forms) {
|
||||
public byte[] Plural_eval(Xol_lang_itm lang, int count, byte[][] forms) {
|
||||
int forms_len = forms.length;
|
||||
switch (forms_len) {
|
||||
case 0: return null; // forms is empty; do nothing
|
||||
@@ -36,5 +36,5 @@ public class Xol_plural_ru implements Xol_plural {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static final Xol_plural_ru _ = new Xol_plural_ru(); Xol_plural_ru() {}
|
||||
public static final Xol_plural_ru Instance = new Xol_plural_ru(); Xol_plural_ru() {}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class Xol_plural_ru_tst {
|
||||
Tst(5, String_.Ary("a"), "a"); // 1 form; count % 10 != (1, 2, 3, 4); but only 1 element, so take 1st
|
||||
}
|
||||
private void Tst(int count, String[] forms, String expd) {
|
||||
byte[] actl = Xol_plural_ru._.Plural_eval(null, count, Bry_.Ary(forms));
|
||||
byte[] actl = Xol_plural_ru.Instance.Plural_eval(null, count, Bry_.Ary(forms));
|
||||
Tfds.Eq_bry(Bry_.new_a7(expd), actl);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user