code: public static <T extends BioPAXElement> Set<T> searchAndCollect(
  		Collection<? extends BioPAXElement> eles, Pattern pattern, int index, Class<T> c)
  	{
  		Set<T> set = new HashSet<T>();
  
  		for (Match match : searchPlain(eles, pattern))
  		{
  			set.add((T) match.get(index));
  		}
  		return set;
  	}
docs: Searches the given pattern starting from the given elements, then collects the specified
  elements of the matches and returns.
  
  @param <T> BioPAX type
  @param eles elements to start from
  @param pattern pattern to search for
  @param index index of the element in the match to collect
  @param c type of the element to collect
  @return set of the elements at the specified index of the matching results