static public ScoutCandidateGroup create(Rectangle group,ScoutWidget[] list,Rectangle[] rectList){
  BitSet set=new BitSet();
  int count=0;
  int groupArea=group.width * group.height;
  int widgetArea=0;
  for (int i=1; i < list.length; i++) {
    if (group.intersects(rectList[i]) && !group.contains(rectList[i])) {
      return null;
    }
    if (group.contains(rectList[i])) {
      set.set(i);
      count++;
      widgetArea+=rectList[i].height * rectList[i].width;
    }
  }
  if (count < 4) {
    return null;
  }
  if (widgetArea * 2 < groupArea) {
    return null;
  }
  ScoutCandidateGroup c=new ScoutCandidateGroup();
  c.mNorth=group.y;
  c.mSouth=group.y + group.height;
  c.mEast=group.x + group.width;
  c.mWest=group.x;
  c.mContainSet=set;
  c.mCount=count;
  c.mGroupArea=groupArea;
  c.mWidgetArea=widgetArea;
  c.mRect=new Rectangle(group);
  c.mRectList=buildRectList(set,rectList);
  return c;
}

static public ScoutCandidateGroup create ( Rectangle group , ScoutWidget [ ] list , Rectangle [ ] rectList ) { BitSet set = new BitSet ( ) ; int count = 0 ; int groupArea = group . width * group . height ; int widgetArea = 0 ; for ( int i = 1 ; i < list . length ; i ++ ) { if ( group . intersects ( rectList [ i ] ) && ! group . contains ( rectList [ i ] ) ) { return null ; } if ( group . contains ( rectList [ i ] ) ) { set . set ( i ) ; count ++ ; widgetArea += rectList [ i ] . height * rectList [ i ] . width ; } } if ( count < 4 ) { return null ; } if ( widgetArea * 2 < groupArea ) { return null ; } ScoutCandidateGroup c = new ScoutCandidateGroup ( ) ; c . mNorth = group . y ; c . mSouth = group . y + group . height ; c . mEast = group . x + group . width ; c . mWest = group . x ; c . mContainSet = set ; c . mCount = count ; c . mGroupArea = groupArea ; c . mWidgetArea = widgetArea ; c . mRect = new Rectangle ( group ) ; c . mRectList = buildRectList ( set , rectList ) ; return c ; }
create a candidate for grouping based on a rectangle
