public Rectangle2D autoPosition(Operator op,int index,boolean setPosition){
  int maxPerRow=(int)Math.max(1,Math.floor(model.getProcessWidth(op.getExecutionUnit()) / (ProcessDrawer.GRID_AUTOARRANGE_WIDTH + 10)));
  int col=index % maxPerRow;
  int row=index / maxPerRow;
  Rectangle2D old=model.getOperatorRect(op);
  double x=col * ProcessDrawer.GRID_AUTOARRANGE_WIDTH + ProcessDrawer.GRID_X_OFFSET;
  double y=ProcessDrawer.GRID_AUTOARRANGE_HEIGHT * row + ProcessDrawer.GRID_Y_OFFSET;
  double width=Math.floor(old != null ? old.getWidth() : ProcessDrawer.OPERATOR_WIDTH);
  double height=Math.floor(old != null ? old.getHeight() : ProcessDrawer.OPERATOR_MIN_HEIGHT);
  Rectangle2D rect;
  if (model.isSnapToGrid()) {
    Point snappedPoint=ProcessDrawUtils.snap(new Point2D.Double(x,y));
    rect=new Rectangle2D.Double(snappedPoint.getX(),snappedPoint.getY(),width,height);
  }
 else {
    rect=new Rectangle2D.Double(x,y,width,height);
  }
  if (setPosition) {
    model.setOperatorRect(op,rect);
    model.fireOperatorMoved(op);
  }
  return rect;
}

public Rectangle2D autoPosition ( Operator op , int index , boolean setPosition ) { int maxPerRow = ( int ) Math . max ( 1 , Math . floor ( model . getProcessWidth ( op . getExecutionUnit ( ) ) / ( ProcessDrawer . GRID_AUTOARRANGE_WIDTH + 10 ) ) ) ; int col = index % maxPerRow ; int row = index / maxPerRow ; Rectangle2D old = model . getOperatorRect ( op ) ; double x = col * ProcessDrawer . GRID_AUTOARRANGE_WIDTH + ProcessDrawer . GRID_X_OFFSET ; double y = ProcessDrawer . GRID_AUTOARRANGE_HEIGHT * row + ProcessDrawer . GRID_Y_OFFSET ; double width = Math . floor ( old != null ? old . getWidth ( ) : ProcessDrawer . OPERATOR_WIDTH ) ; double height = Math . floor ( old != null ? old . getHeight ( ) : ProcessDrawer . OPERATOR_MIN_HEIGHT ) ; Rectangle2D rect ; if ( model . isSnapToGrid ( ) ) { Point snappedPoint = ProcessDrawUtils . snap ( new Point2D . Double ( x , y ) ) ; rect = new Rectangle2D . Double ( snappedPoint . getX ( ) , snappedPoint . getY ( ) , width , height ) ; } else { rect = new Rectangle2D . Double ( x , y , width , height ) ; } if ( setPosition ) { model . setOperatorRect ( op , rect ) ; model . fireOperatorMoved ( op ) ; } return rect ; }
calculates the position of an operator .
