public HorizontalDrawingInfoImpl(double diagramStart,double diagramMinWidth,DoubleConverter widthConverter,double lifelineWidth,double lifelineXPadding,int lifelineCount,int lastTick,Collection<ContainerPadding> paddings){
  containerLeftPadding=new HashMap<Container,Double>((int)(paddings.size() / 0.7));
  containerRightPadding=new HashMap<Container,Double>((int)(paddings.size() / 0.7));
  horizontalDrawingInfos=new LifelineHorizontalDrawingInfo[lifelineCount];
  this.diagramStart=diagramStart;
  double maxPadding=0;
  double[][] leftPaddings=new double[lifelineCount][];
  double[][] rightPaddings=new double[lifelineCount][];
  for (int i=0; i < lifelineCount; i++) {
    PaddingInfo paddingInfo=getPaddings(i,true,lastTick,paddings);
    leftPaddings[i]=paddingInfo.paddings;
    maxPadding=Math.max(maxPadding,paddingInfo.maxPadding);
    paddingInfo=getPaddings(i,false,lastTick,paddings);
    rightPaddings[i]=paddingInfo.paddings;
    maxPadding=Math.max(maxPadding,paddingInfo.maxPadding);
  }
  lifelineWidth+=maxPadding * 2;
  double diagramWidth=lifelineWidth * lifelineCount + lifelineXPadding * (lifelineCount + 1);
  if (diagramWidth < diagramMinWidth) {
    diagramWidth=diagramMinWidth;
    if (lifelineCount > 0) {
      lifelineWidth=(diagramWidth - lifelineXPadding * (lifelineCount + 1)) / lifelineCount;
    }
  }
  diagramWidth=widthConverter.convert(diagramWidth);
  double lifelineHeadLeftStart=(diagramWidth - (lifelineWidth * lifelineCount + lifelineXPadding * (lifelineCount - 1))) / 2.0;
  this.diagramWidth=diagramWidth;
  for (int i=0; i < horizontalDrawingInfos.length; i++) {
    horizontalDrawingInfos[i]=new LifelineHorizontalDrawingInfoImpl(leftPaddings[i],rightPaddings[i],lifelineHeadLeftStart + (lifelineWidth + lifelineXPadding) * i,lifelineHeadLeftStart + (lifelineWidth + lifelineXPadding) * i + lifelineWidth);
  }
}

public HorizontalDrawingInfoImpl ( double diagramStart , double diagramMinWidth , DoubleConverter widthConverter , double lifelineWidth , double lifelineXPadding , int lifelineCount , int lastTick , Collection < ContainerPadding > paddings ) { containerLeftPadding = new HashMap < Container , Double > ( ( int ) ( paddings . size ( ) / 0.7 ) ) ; containerRightPadding = new HashMap < Container , Double > ( ( int ) ( paddings . size ( ) / 0.7 ) ) ; horizontalDrawingInfos = new LifelineHorizontalDrawingInfo [ lifelineCount ] ; this . diagramStart = diagramStart ; double maxPadding = 0 ; double [ ] [ ] leftPaddings = new double [ lifelineCount ] [ ] ; double [ ] [ ] rightPaddings = new double [ lifelineCount ] [ ] ; for ( int i = 0 ; i < lifelineCount ; i ++ ) { PaddingInfo paddingInfo = getPaddings ( i , true , lastTick , paddings ) ; leftPaddings [ i ] = paddingInfo . paddings ; maxPadding = Math . max ( maxPadding , paddingInfo . maxPadding ) ; paddingInfo = getPaddings ( i , false , lastTick , paddings ) ; rightPaddings [ i ] = paddingInfo . paddings ; maxPadding = Math . max ( maxPadding , paddingInfo . maxPadding ) ; } lifelineWidth += maxPadding * 2 ; double diagramWidth = lifelineWidth * lifelineCount + lifelineXPadding * ( lifelineCount + 1 ) ; if ( diagramWidth < diagramMinWidth ) { diagramWidth = diagramMinWidth ; if ( lifelineCount > 0 ) { lifelineWidth = ( diagramWidth - lifelineXPadding * ( lifelineCount + 1 ) ) / lifelineCount ; } } diagramWidth = widthConverter . convert ( diagramWidth ) ; double lifelineHeadLeftStart = ( diagramWidth - ( lifelineWidth * lifelineCount + lifelineXPadding * ( lifelineCount - 1 ) ) ) / 2.0 ; this . diagramWidth = diagramWidth ; for ( int i = 0 ; i < horizontalDrawingInfos . length ; i ++ ) { horizontalDrawingInfos [ i ] = new LifelineHorizontalDrawingInfoImpl ( leftPaddings [ i ] , rightPaddings [ i ] , lifelineHeadLeftStart + ( lifelineWidth + lifelineXPadding ) * i , lifelineHeadLeftStart + ( lifelineWidth + lifelineXPadding ) * i + lifelineWidth ) ; } }
calculates the actual lifeline and diagram width .
