Optimization moved to method
This commit is contained in:
@@ -40,6 +40,11 @@ public class Enum {
|
|||||||
|
|
||||||
EnumSet<E> enumSet = EnumSet.noneOf(enumClass);
|
EnumSet<E> enumSet = EnumSet.noneOf(enumClass);
|
||||||
|
|
||||||
|
// Early exit if empty set
|
||||||
|
|
||||||
|
if (bitVector == 0)
|
||||||
|
return enumSet;
|
||||||
|
|
||||||
for (E enumValue : enumClass.getEnumConstants()) {
|
for (E enumValue : enumClass.getEnumConstants()) {
|
||||||
if ((bitVector & (1L << enumValue.ordinal())) != 0) {
|
if ((bitVector & (1L << enumValue.ordinal())) != 0) {
|
||||||
enumSet.add(enumValue);
|
enumSet.add(enumValue);
|
||||||
|
|||||||
@@ -497,13 +497,11 @@ public class ItemTemplate {
|
|||||||
|
|
||||||
int group_tactics_bitvector = ((Long) jsonObject.get("rune_group_tactics")).intValue();
|
int group_tactics_bitvector = ((Long) jsonObject.get("rune_group_tactics")).intValue();
|
||||||
|
|
||||||
if (group_tactics_bitvector != 0)
|
rune_group_tactics.addAll(Enum.fromLong(group_tactics_bitvector, Enum.MobBehaviourType.class));
|
||||||
rune_group_tactics.addAll(Enum.fromLong(group_tactics_bitvector, Enum.MobBehaviourType.class));
|
|
||||||
|
|
||||||
int group_role_bitvector = ((Long) jsonObject.get("rune_group_role_set")).intValue();
|
int group_role_bitvector = ((Long) jsonObject.get("rune_group_role_set")).intValue();
|
||||||
|
|
||||||
if (group_role_bitvector != 0)
|
rune_group_role_set.addAll(Enum.fromLong(group_role_bitvector, Enum.MobBehaviourType.class));
|
||||||
rune_group_role_set.addAll(Enum.fromLong(group_role_bitvector, Enum.MobBehaviourType.class));
|
|
||||||
|
|
||||||
JSONArray enemy_types_json = (JSONArray) jsonObject.get("rune_enemy_monster_types");
|
JSONArray enemy_types_json = (JSONArray) jsonObject.get("rune_enemy_monster_types");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user