Skip to content

Commit

Permalink
ref: better code performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Uhutown committed Oct 7, 2024
1 parent 1f199af commit dc53a45
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

public interface SignalAnimation extends Predicate<Map<SEProperty, String>> {

public SignalAnimation with(final String model);

public void updateAnimation();

public ModelTranslation getModelTranslation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class SignalAnimationRotation implements SignalAnimation {
private AnimationRotionCalc calc;

private final Predicate<Map<SEProperty, String>> predicate;
private String model;
private final float animationSpeed;
private final RotationAxis axis;
private final float rotation;
Expand All @@ -29,12 +28,6 @@ public SignalAnimationRotation(final Predicate<Map<SEProperty, String>> predicat
this.pivot = pivot;
}

@Override
public SignalAnimation with(final String model) {
this.model = model;
return this;
}

@Override
public void updateAnimation() {
calc.updateAnimation();
Expand Down Expand Up @@ -92,7 +85,7 @@ public boolean test(final Map<SEProperty, String> properties) {

@Override
public int hashCode() {
return Objects.hash(animationSpeed, axis, model, pivot, calc, rotation);
return Objects.hash(animationSpeed, axis, pivot, calc, rotation);
}

@Override
Expand All @@ -105,9 +98,8 @@ public boolean equals(final Object obj) {
return false;
final SignalAnimationRotation other = (SignalAnimationRotation) obj;
return Float.floatToIntBits(animationSpeed) == Float.floatToIntBits(other.animationSpeed)
&& axis == other.axis && Objects.equals(model, other.model)
&& Objects.equals(pivot, other.pivot) && Objects.equals(calc, other.calc)
&& Objects.equals(rotation, other.rotation);
&& axis == other.axis && Objects.equals(pivot, other.pivot)
&& Objects.equals(calc, other.calc) && Objects.equals(rotation, other.rotation);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ public SignalAnimationTranslation(Predicate<Map<SEProperty, String>> predicate,
this.dest = dest;
}

@Override
public SignalAnimation with(final String model) {
this.model = model;
return this;
}

@Override
public void updateAnimation() {
calc.updateAnimation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static void loadAllAnimations() {
configs.translationY, configs.translationZ);
final List<SignalAnimation> animatinos = new ArrayList<>();
for (final SignalAnimationConfig config : configs.animationConfigs) {
animatinos.add(config.createAnimation(info).with(modelName));
animatinos.add(config.createAnimation(info));
}
if (!animatinos.isEmpty())
modelToAnimation.put(Maps.immutableEntry(modelName, vec), animatinos);
Expand Down

0 comments on commit dc53a45

Please sign in to comment.