int () { assert myCurrentImage != null; if (!myHorizontal) { return myCurrentImage.getWidth(); } int sign = myExpand ? 1 : -1; int result = myCurrentImage.getWidth() + sign * myAnimationIterationStep; if (result <= 0 || result > myImage.getWidth()) { return -1; } return result; }