@Override
protected synchronized String getResourceName() {
boolean animationsTerminated = true;
if ( ! this.coloringAnimations.isEmpty() ) {
JunctionColoringAnimation bestAnimation = coloringAnimations.iterator().next();
double higherNonFullPercentage = bestAnimation.getPercentageDoneAnimation();
for (JunctionColoringAnimation coloringAnimation : this.coloringAnimations) {
final double animationPercentage = coloringAnimation.getPercentageDoneAnimation();
if ( animationPercentage > higherNonFullPercentage && ( animationPercentage != 1.0 || higherNonFullPercentage == 0.0 ) ) {
higherNonFullPercentage = animationPercentage;
bestAnimation = coloringAnimation;
}
if ( ! coloringAnimation.isTerminated() ) {
animationsTerminated = false;
}
}
if ( animationsTerminated ) {
this.coloringAnimations.clear();
} else if ( higherNonFullPercentage >= HALF_ANIMATION_THRESHOLD && previousColor != bestAnimation.isColoring() ) {
@NotNull
@NonNls
final String suffixString;
final PERPENDICULAR_DIRECTION animationDirection = bestAnimation.getDirection();
Set<PERPENDICULAR_DIRECTION> directions = getAvailableDirections();
if ( bestAnimation.isColoring() ) {
suffixString = getHalfResourceNameByDirections( directions, animationDirection.getOpposite() );
} else {
Deque<PERPENDICULAR_DIRECTION> junctionDirections = new LinkedList<>( directions );
if ( junctionDirections.size() == 2 ) {