public static Collection<Object> filterDescendants(mxIGraphModel model,Filter filter,Object parent){
  List<Object> result=new ArrayList<Object>();
  if (filter == null || filter.filter(parent)) {
    result.add(parent);
  }
  int childCount=model.getChildCount(parent);
  for (int i=0; i < childCount; i++) {
    Object child=model.getChildAt(parent,i);
    result.addAll(filterDescendants(model,filter,child));
  }
  return result;
}

public static Collection < Object > filterDescendants ( mxIGraphModel model , Filter filter , Object parent ) { List < Object > result = new ArrayList < Object > ( ) ; if ( filter == null || filter . filter ( parent ) ) { result . add ( parent ) ; } int childCount = model . getChildCount ( parent ) ; for ( int i = 0 ; i < childCount ; i ++ ) { Object child = model . getChildAt ( parent , i ) ; result . addAll ( filterDescendants ( model , filter , child ) ) ; } return result ; }
creates a collection of cells using the visitor pattern .
