public List<Node> listAvailableCrossoverNodes(Node node,Class<?> type){
  List<Node> result=new ArrayList<Node>();
  if (type.isAssignableFrom(node.getReturnType())) {
    result.add(node);
  }
  for (int i=0; i < node.getNumberOfArguments(); i++) {
    result.addAll(listAvailableCrossoverNodes(node.getArgument(i),type));
  }
  return result;
}

public List < Node > listAvailableCrossoverNodes ( Node node , Class < ? > type ) { List < Node > result = new ArrayList < Node > ( ) ; if ( type . isAssignableFrom ( node . getReturnType ( ) ) ) { result . add ( node ) ; } for ( int i = 0 ; i < node . getNumberOfArguments ( ) ; i ++ ) { result . addAll ( listAvailableCrossoverNodes ( node . getArgument ( i ) , type ) ) ; } return result ; }
returns the list of all nodes in the tree rooted at the specified node with the given return type . this method ensures the crossover remains strongly - typed .
