res.alignment = align; res.maximum = maxSize; res.preferred = prefSize; res.minimum = minSize; return res;
sr.preferred = (int) Math.min((long) totalAscentPref + (long) totalDescentPref, Integer.MAX_VALUE);   if (sr.preferred > 0) sr.alignment = (float) totalAscentPref / sr.preferred;  if (sr.alignment == 0) {  sr.minimum = totalDescentMin; sr.maximum = totalDescentMax; } else if (sr.alignment == 1.0F) {  sr.minimum = totalAscentMin; sr.maximum = totalAscentMax; } else { sr.minimum = Math.max((int) (totalAscentMin / sr.alignment), (int) (totalDescentMin / (1.0F - sr.alignment))); sr.maximum = Math.min((int) (totalAscentMax / sr.alignment), (int) (totalDescentMax / (1.0F - sr.alignment))); } return sr;
  protected SizeRequirements baselineRequirements(int axis,                                                  SizeRequirements sr)  {    updateChildRequirements(axis);    SizeRequirements res = sr;    if (res == null)      res = new SizeRequirements();    float minLeft = 0;    float minRight = 0;    float prefLeft = 0;    float prefRight = 0;    float maxLeft = 0;    float maxRight = 0;    for (int i = 0; i < childReqs[axis].length; i++)      {        float myMinLeft = childReqs[axis][i].minimum * childReqs[axis][i].alignment;        float myMinRight = childReqs[axis][i].minimum - myMinLeft;        minLeft = Math.max(myMinLeft, minLeft);        minRight = Math.max(myMinRight, minRight);        float myPrefLeft = childReqs[axis][i].preferred * childReqs[axis][i].alignment;        float myPrefRight = childReqs[axis][i].preferred - myPrefLeft;        prefLeft = Math.max(myPrefLeft, prefLeft);        prefRight = Math.max(myPrefRight, prefRight);        float myMaxLeft = childReqs[axis][i].maximum * childReqs[axis][i].alignment;        float myMaxRight = childReqs[axis][i].maximum - myMaxLeft;        maxLeft = Math.max(myMaxLeft, maxLeft);        maxRight = Math.max(myMaxRight, maxRight);      }    int minSize = (int) (minLeft + minRight);    int prefSize = (int) (prefLeft + prefRight);    int maxSize = (int) (maxLeft + maxRight);    float align = prefLeft / (prefRight + prefLeft);    if (Float.isNaN(align))      align = 0;    res.alignment = align;    res.maximum = maxSize;    res.preferred = prefSize;    res.minimum = minSize;    return res;  }