// Path: src/main/java/ch/picard/ppimapbuilder/data/Pair.java
// public class Pair<T> implements Comparable<Pair<T>> {
// 
// 	private final T first;
// 	private final T second;
// 
// 	public Pair(List<T> elems) {
// 		this(elems.get(0), elems.get(1));
// 	}
// 
// 	public Pair(T first, T second) {
// 		this.first = first;
// 		this.second = second;
// 	}
// 
// 	public T getFirst() {
// 		return first;
// 	}
// 
// 	public T getSecond() {
// 		return second;
// 	}
// 
// 	public boolean isNotNull() {
// 		return first != null && second != null;
// 	}
// 
// 	public boolean isEmpty() {
// 		return first == null && second == null;
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		return Objects.hashCode(first.hashCode(), -1, second.hashCode());
// 	}
// 
// 	@Override
// 	public boolean equals(Object other) {
// 		if(other instanceof Pair){
// 			Pair otherPair = (Pair) other;
// 
// 			return (
// 					(otherPair.first == null && first == null) ||
// 					(otherPair.first != null && otherPair.first.equals(first))
// 				)
// 					&&
// 				(
// 					(otherPair.second == null && second == null) ||
// 					(otherPair.second != null && otherPair.second.equals(second))
// 				);
// 		}
// 		else return false;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "Pair["+first.toString()+", "+second.toString()+"]";
// 	}
// 
// 	@Override
// 	public int compareTo(Pair<T> o) {
// 		return toString().compareTo(o.toString());
// 	}
// }
// 
// Path: src/main/java/ch/picard/ppimapbuilder/data/PairUtils.java
// public class PairUtils {
// 
// 	/**
// 	 * Creates pair combination of a Set of elements
// 	 * @param elements Set of elements to combine to one an other
// 	 * @param selfCombination if true, pairs of duplicate will be added in the list of combinations
// 	 * @param orderedPairs if true and if the elements are Comparable, the combination pairs will be ascending ordered
// 	 */
// 	@SuppressWarnings("unchecked")
// 	public static <T> Set<Pair<T>> createCombinations(Set<T> elements, boolean selfCombination, boolean orderedPairs) {
// 		final ArrayList<T> list = new ArrayList<T>(elements);
// 
// 		T A, B;
// 		final Set<Pair<T>> combinations = new HashSet<Pair<T>>();
// 		for (int i = 0, length = list.size(); i < length; i++) {
// 			A = list.get(i);
// 
// 			if(selfCombination)
// 				combinations.add(new Pair<T>(A, A));
// 
// 			for (int j = i + 1; j < length; j++) {
// 				B = list.get(j);
// 
// 				if(orderedPairs && A instanceof Comparable && ((Comparable) A).compareTo(B) > 0)
// 					combinations.add(new Pair<T>(B, A));
// 				else
// 					combinations.add(new Pair<T>(A, B));
// 			}
// 		}
// 
// 		return combinations;
// 	}
// 
// }


import ch.picard.ppimapbuilder.data.Pair;
import ch.picard.ppimapbuilder.data.PairUtils;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/*   
 * This file is part of PPiMapBuilder.
 *
 * PPiMapBuilder is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * PPiMapBuilder is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PPiMapBuilder.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Copyright 2015 Echeverria P.C., Dupuis P., Cornut G., Gravouil K., Kieffer A., Picard D.
 * 
 */    	
    
package ch.picard.ppimapbuilder.data.organism;



public class OrganismUtils {

	private static final Pattern pattern = Pattern.compile("\\(.*\\)");

	/**
	 * Creates pair combination of organisms using an organism list.
	 */
// Path: src/main/java/ch/picard/ppimapbuilder/data/Pair.java
// public class Pair<T> implements Comparable<Pair<T>> {
// 
// 	private final T first;
// 	private final T second;
// 
// 	public Pair(List<T> elems) {
// 		this(elems.get(0), elems.get(1));
// 	}
// 
// 	public Pair(T first, T second) {
// 		this.first = first;
// 		this.second = second;
// 	}
// 
// 	public T getFirst() {
// 		return first;
// 	}
// 
// 	public T getSecond() {
// 		return second;
// 	}
// 
// 	public boolean isNotNull() {
// 		return first != null && second != null;
// 	}
// 
// 	public boolean isEmpty() {
// 		return first == null && second == null;
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		return Objects.hashCode(first.hashCode(), -1, second.hashCode());
// 	}
// 
// 	@Override
// 	public boolean equals(Object other) {
// 		if(other instanceof Pair){
// 			Pair otherPair = (Pair) other;
// 
// 			return (
// 					(otherPair.first == null && first == null) ||
// 					(otherPair.first != null && otherPair.first.equals(first))
// 				)
// 					&&
// 				(
// 					(otherPair.second == null && second == null) ||
// 					(otherPair.second != null && otherPair.second.equals(second))
// 				);
// 		}
// 		else return false;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "Pair["+first.toString()+", "+second.toString()+"]";
// 	}
// 
// 	@Override
// 	public int compareTo(Pair<T> o) {
// 		return toString().compareTo(o.toString());
// 	}
// }
// 
// Path: src/main/java/ch/picard/ppimapbuilder/data/PairUtils.java
// public class PairUtils {
// 
// 	/**
// 	 * Creates pair combination of a Set of elements
// 	 * @param elements Set of elements to combine to one an other
// 	 * @param selfCombination if true, pairs of duplicate will be added in the list of combinations
// 	 * @param orderedPairs if true and if the elements are Comparable, the combination pairs will be ascending ordered
// 	 */
// 	@SuppressWarnings("unchecked")
// 	public static <T> Set<Pair<T>> createCombinations(Set<T> elements, boolean selfCombination, boolean orderedPairs) {
// 		final ArrayList<T> list = new ArrayList<T>(elements);
// 
// 		T A, B;
// 		final Set<Pair<T>> combinations = new HashSet<Pair<T>>();
// 		for (int i = 0, length = list.size(); i < length; i++) {
// 			A = list.get(i);
// 
// 			if(selfCombination)
// 				combinations.add(new Pair<T>(A, A));
// 
// 			for (int j = i + 1; j < length; j++) {
// 				B = list.get(j);
// 
// 				if(orderedPairs && A instanceof Comparable && ((Comparable) A).compareTo(B) > 0)
// 					combinations.add(new Pair<T>(B, A));
// 				else
// 					combinations.add(new Pair<T>(A, B));
// 			}
// 		}
// 
// 		return combinations;
// 	}
// 
// }


// Path: src/main/java/ch/picard/ppimapbuilder/data/organism/OrganismUtils.java
import ch.picard.ppimapbuilder.data.Pair;
import ch.picard.ppimapbuilder.data.PairUtils;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/*   
 * This file is part of PPiMapBuilder.
 *
 * PPiMapBuilder is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * PPiMapBuilder is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PPiMapBuilder.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Copyright 2015 Echeverria P.C., Dupuis P., Cornut G., Gravouil K., Kieffer A., Picard D.
 * 
 */    	
    
package ch.picard.ppimapbuilder.data.organism;



public class OrganismUtils {

	private static final Pattern pattern = Pattern.compile("\\(.*\\)");

	/**
	 * Creates pair combination of organisms using an organism list.
	 */
	public static Set<Pair<Organism>> createCombinations(List<Organism> organisms) {