double (int total) { double size1 = myProportion * total; double size2 = total - size1; if (!isHonorMinimumSize()) { return size1; } double mSize1 = getDimension(myFirstComponent.getMinimumSize()); double mSize2 = getDimension(mySecondComponent.getMinimumSize()); if (myHonorPreferredSize && size1 > mSize1 && size2 > mSize2) { mSize1 = getDimension(myFirstComponent.getPreferredSize()); mSize2 = getDimension(mySecondComponent.getPreferredSize()); } if (total < mSize1 + mSize2) { size1 = switch (myLackOfSpaceStrategy) { case SIMPLE_RATIO -> { double proportion = mSize1 / (mSize1 + mSize2); yield proportion * total; } case HONOR_THE_FIRST_MIN_SIZE -> mSize1; case HONOR_THE_SECOND_MIN_SIZE -> total - mSize2; }; } else { if (size1 < mSize1) { size1 = mSize1; } else if (size2 < mSize2) { size2 = mSize2; size1 = total - size2; } } return size1; }