code: public static Map<BioPAXElement, List<Match>> search(final Model model, final Pattern pattern,
  														 final ProgressWatcher prg)
  	{
  		final Map<BioPAXElement, List<Match>> map = new ConcurrentHashMap<BioPAXElement, List<Match>>();
  		final ExecutorService exec = Executors.newFixedThreadPool(20);
  
  		Set<? extends BioPAXElement> eles = model.getObjects(pattern.getStartingClass());
  		if (prg != null) prg.setTotalTicks(eles.size());
  
  		for (final BioPAXElement ele : eles)
  		{
  			exec.execute(new Runnable() {
  				@Override
  				public void run() {
  					List<Match> matches = search(ele, pattern);
  					if (!matches.isEmpty())
  					{
  						map.put(ele, matches);
  					}
  					if (prg != null) prg.tick(1);
  				}
  			});
  		}
  
  		exec.shutdown();
  		try {
  			exec.awaitTermination(10, TimeUnit.MINUTES);
  		} catch (InterruptedException e) {
  			throw new RuntimeException("search, failed due to exec timed out.", e);
  		}
  
  		return Collections.unmodifiableMap(map);
  	}
docs: Searches the given pattern in the given model.
  @param model model to search in
  @param pattern pattern to search for
  @param prg progress watcher to keep track of the progress
  @return map from starting elements to the list matching results