| 1 | package sh.okx.rankup.util; | |
| 2 | ||
| 3 | import net.md_5.bungee.api.ChatColor; | |
| 4 | ||
| 5 | public class Colour { | |
| 6 | ||
| 7 | private static final char altColorChar = '&'; | |
| 8 | ||
| 9 | public static String translate(String string) { | |
| 10 | StringBuilder result = new StringBuilder(); | |
| 11 | char[] b = string.toCharArray(); | |
| 12 |
2
1. translate : changed conditional boundary → KILLED 2. translate : negated conditional → KILLED |
for (int i = 0; i < b.length; i++) { |
| 13 |
4
1. translate : changed conditional boundary → SURVIVED 2. translate : Replaced integer subtraction with addition → SURVIVED 3. translate : negated conditional → KILLED 4. translate : negated conditional → KILLED |
if (b[i] == altColorChar && i < b.length - 1) { |
| 14 |
3
1. translate : changed conditional boundary → SURVIVED 2. translate : Replaced integer addition with subtraction → KILLED 3. translate : negated conditional → KILLED |
if ("0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i + 1]) > -1) { |
| 15 |
1
1. translate : Replaced integer addition with subtraction → KILLED |
result.append(ChatColor.COLOR_CHAR).append(Character.toLowerCase(b[i + 1])); |
| 16 |
1
1. translate : Changed increment from 1 to -1 → TIMED_OUT |
i ++; |
| 17 |
5
1. translate : changed conditional boundary → NO_COVERAGE 2. translate : Replaced integer addition with subtraction → NO_COVERAGE 3. translate : Replaced integer subtraction with addition → NO_COVERAGE 4. translate : negated conditional → NO_COVERAGE 5. translate : negated conditional → NO_COVERAGE |
} else if ('#' == b[i + 1] && i < b.length - 7) { |
| 18 |
2
1. translate : Replaced integer addition with subtraction → NO_COVERAGE 2. translate : Replaced integer addition with subtraction → NO_COVERAGE |
String hex = string.substring(i + 1, i + 8); |
| 19 | result.append(ChatColor.of(hex)); | |
| 20 |
1
1. translate : Changed increment from 7 to -7 → NO_COVERAGE |
i += 7; |
| 21 | } else { | |
| 22 | result.append(b[i]); | |
| 23 | } | |
| 24 | } else { | |
| 25 | result.append(b[i]); | |
| 26 | } | |
| 27 | } | |
| 28 |
1
1. translate : replaced return value with "" for sh/okx/rankup/util/Colour::translate → KILLED |
return result.toString(); |
| 29 | } | |
| 30 | } | |
Mutations | ||
| 12 |
1.1 2.2 |
|
| 13 |
1.1 2.2 3.3 4.4 |
|
| 14 |
1.1 2.2 3.3 |
|
| 15 |
1.1 |
|
| 16 |
1.1 |
|
| 17 |
1.1 2.2 3.3 4.4 5.5 |
|
| 18 |
1.1 2.2 |
|
| 20 |
1.1 |
|
| 28 |
1.1 |