diff --git a/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/Allele.java b/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/Allele.java index 829e7fb..1dbd92e 100644 --- a/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/Allele.java +++ b/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/Allele.java @@ -20,11 +20,11 @@ public class Allele implements Comparable { private final boolean dominant; public Allele(String uid, String name, boolean dominant) { - Validate.notEmpty(uid, "The allele uid must not be null or empty!"); - Validate.isTrue(PatternUtil.UID_PATTERN.matcher(uid).matches(), "The allele uid must start with a prefix " + + Validate.notEmpty(uid, "等位基因 uid 不得为空或为空!"); + Validate.isTrue(PatternUtil.UID_PATTERN.matcher(uid).matches(), "等位基因 uid 必须以前缀开头 " + "and be in the lower snake case format, got " + uid + "!"); - Validate.notEmpty(name, "The allele name must not be null or empty!"); - Validate.isTrue(PatternUtil.UPPER_SNAKE.matcher(name).matches(), "The allele name must be " + + Validate.notEmpty(name, "等位基因名称不得为无或空!"); + Validate.isTrue(PatternUtil.UPPER_SNAKE.matcher(name).matches(), "等位基因名称必须为 " + "in the upper snake case format, got " + name + "!"); this.uid = uid; diff --git a/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleEffect.java b/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleEffect.java index 6edf956..7c55a9a 100644 --- a/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleEffect.java +++ b/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleEffect.java @@ -18,7 +18,7 @@ public class AlleleEffect extends Allele { public AlleleEffect(String uid, String name, EffectFunction effectFunction, boolean dominant) { super(uid, name, dominant); - Validate.notNull(effectFunction, "The effect function cannot be null!"); + Validate.notNull(effectFunction, "效果函数不能为空!"); this.effectFunction = effectFunction; } diff --git a/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AllelePlant.java b/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AllelePlant.java index b911d2a..db1d442 100644 --- a/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AllelePlant.java +++ b/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AllelePlant.java @@ -17,7 +17,7 @@ public class AllelePlant extends Allele { public AllelePlant(String uid, String name, Material value, boolean dominant) { super(uid, name, dominant); - Validate.isTrue(value.isBlock(), "The material of AllelePlant has to be a block, got " + value + "!"); + Validate.isTrue(value.isBlock(), "等位基因植物的材料必须是块状的,得到 " + value + "!"); this.value = value; } diff --git a/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleRegistry.java b/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleRegistry.java index a944ee4..a0865a1 100644 --- a/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleRegistry.java +++ b/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleRegistry.java @@ -49,12 +49,12 @@ public Allele get(ChromosomeType type, String uid) { */ @SuppressWarnings("unchecked") public void register(ChromosomeType type, T allele) { - Validate.notNull(type, "Cannot register an Allele for null ChromosomeType!"); - Validate.notNull(allele, "Cannot register a null Allele!"); + Validate.notNull(type, "无法为零染色体类型注册等位基因!"); + Validate.notNull(allele, "无法注册空等位基因!"); if (!type.getAlleleClass().isAssignableFrom(allele.getClass())) { - throw new IllegalArgumentException("Allele class (" + allele.getClass() - + ") does not match required ChromosomeType class (" + type.getAlleleClass() + ")!"); + throw new IllegalArgumentException("等位基因类 (" + allele.getClass() + + ") 与所需的染色体类型类不匹配 (" + type.getAlleleClass() + ")!"); } Map alleleMap = (Map) allelesByChromosomeType.computeIfAbsent(type, k -> new LinkedHashMap<>()); @@ -72,9 +72,9 @@ public void register(ChromosomeType type, T allele) { * @param The type of the {@link AlleleValue} that is used to create the {@link Allele} instance */ public > void register(ChromosomeType type, V alleleValue, String uid) { - Validate.notNull(type, "The chromosome type cannot be null!"); - Validate.notEmpty(uid, "The allele uid cannot be null or empty!"); - Validate.notNull(alleleValue, "The allele value cannot be null!"); + Validate.notNull(type, "染色体类型不能为空!"); + Validate.notEmpty(uid, "等位基因 uid 不能为无或空!"); + Validate.notNull(alleleValue, "等位基因值不能为空!"); boolean dominant = alleleValue.isDominant(); T value = alleleValue.getValue(); @@ -94,7 +94,7 @@ public > void register(ChromosomeType type, V allele AlleleEffect allele = new AlleleEffect(uid, name, (AlleleEffect.EffectFunction) value, dominant); register(type, allele); } else { - throw new IllegalArgumentException("Could not create allele for uid: " + uid + " and value " + valueClass); + throw new IllegalArgumentException("无法为 uid 创建等位基因: " + uid + " 和变量 " + valueClass); } } diff --git a/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleService.java b/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleService.java index 7fc8c68..b7192db 100644 --- a/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleService.java +++ b/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleService.java @@ -16,13 +16,13 @@ public AlleleService(AlleleRegistry alleleRegistry) { } public void set(Allele[] template, ChromosomeType type, String uid) { - Validate.notNull(template, "Cannot update null allele template!"); - Validate.notNull(type, "Cannot update alleles belonging to null ChromosomeType!"); - Validate.notNull(uid, "Cannot update alleles by allele with null uid!"); + Validate.notNull(template, "无法更新空等位基因模板!"); + Validate.notNull(type, "无法更新属于空染色体类型的等位基因!"); + Validate.notNull(uid, "无法通过等位基因更新具有空 uid 的等位基因!"); Allele allele = alleleRegistry.get(type, uid); if (allele == null) { - throw new IllegalArgumentException("There is no Allele for type: " + type + " and uid: " + uid); + throw new IllegalArgumentException("这里没有该类型的等位基因: " + type + " 和 uid: " + uid); } template[type.ordinal()] = allele; diff --git a/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleValue.java b/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleValue.java index 7deecb5..f2fb2a0 100644 --- a/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleValue.java +++ b/src/main/java/cz/martinbrom/slimybees/core/genetics/alleles/AlleleValue.java @@ -16,7 +16,7 @@ public AlleleValue(T value) { } public AlleleValue(T value, boolean dominant) { - Validate.notNull(value, "Cannot create AlleleValue from null value!"); + Validate.notNull(value, "无法从空值创建等位基因值!"); this.value = value; this.dominant = dominant;