if (sr == null) sr = new SizeRequirements(); else { sr.maximum = 0; sr.minimum = 0; sr.preferred = 0; sr.alignment = 0.5F; }  int count = getViewCount();  int aboveBaseline = 0; int belowBaseline = 0; int aboveBaselineMin = 0; int belowBaselineMin = 0; int aboveBaselineMax = 0; int belowBaselineMax = 0;  for (int i = 0; i < count; ++i) { View child = getView(i); float align = child.getAlignment(axis); int pref = (int) child.getPreferredSpan(axis); int min = (int) child.getMinimumSpan(axis); int max = (int) child.getMaximumSpan(axis); aboveBaseline += (int) (align * pref); belowBaseline += (int) ((1.F - align) * pref); aboveBaselineMin += (int) (align * min); belowBaselineMin += (int) ((1.F - align) * min); aboveBaselineMax += (int) (align * max); belowBaselineMax += (int) ((1.F - align) * max); } sr.minimum = aboveBaselineMin + belowBaselineMin; sr.maximum = aboveBaselineMax + belowBaselineMax; sr.preferred = aboveBaseline + belowBaseline; if (aboveBaseline == 0) sr.alignment = 1.0F; else sr.alignment = (float) (sr.preferred / aboveBaseline);  return sr;
SizeRequirements[] childReqs = getChildRequirements(axis); return SizeRequirements.getAlignedSizeRequirements(childReqs);
  protected SizeRequirements calculateMinorAxisRequirements(int axis,                                                           SizeRequirements sr)  {    if (sr == null)      sr = new SizeRequirements();    else      {        sr.maximum = 0;        sr.minimum = 0;        sr.preferred = 0;        sr.alignment = 0.5F;      }    int count = getViewCount();    int aboveBaseline = 0;    int belowBaseline = 0;    int aboveBaselineMin = 0;    int belowBaselineMin = 0;    int aboveBaselineMax = 0;    int belowBaselineMax = 0;        for (int i = 0; i < count; ++i)      {        View child = getView(i);        float align = child.getAlignment(axis);        int pref = (int) child.getPreferredSpan(axis);        int min = (int) child.getMinimumSpan(axis);        int max = (int) child.getMaximumSpan(axis);        aboveBaseline += (int) (align * pref);        belowBaseline += (int) ((1.F - align) * pref);        aboveBaselineMin += (int) (align * min);        belowBaselineMin += (int) ((1.F - align) * min);        aboveBaselineMax += (int) (align * max);        belowBaselineMax += (int) ((1.F - align) * max);      }    sr.minimum = aboveBaselineMin + belowBaselineMin;    sr.maximum = aboveBaselineMax + belowBaselineMax;    sr.preferred = aboveBaseline + belowBaseline;    if (aboveBaseline == 0)      sr.alignment = 1.0F;    else      sr.alignment = (float) (sr.preferred / aboveBaseline);    return sr;  }