public static List<Pair<BrainRegionDictTerm, BrainRegionDictTerm>> combinaisonPairs(
            Collection<BrainRegionDictTerm> br) {

        List<Pair<BrainRegionDictTerm, BrainRegionDictTerm>> pairs = newArrayList();
        // we need at least 2 elems to find pairs
        if (br == null || br.size() < 2)
            return pairs;

        // Create the initial vector
        ICombinatoricsVector<BrainRegionDictTerm> initialVector = Factory
                .createVector(br);

        // Create a simple combination generator to generate 2-combinations of
        // the initial vector
        Generator<BrainRegionDictTerm> gen = Factory
                .createSimpleCombinationGenerator(initialVector, 2);

        // get all possible combinations
        for (ICombinatoricsVector<BrainRegionDictTerm> combination : gen) {
            BrainRegionDictTerm br1 = combination.getValue(0);
            BrainRegionDictTerm br2 = combination.getValue(1);

            // filter if same text
            if (br1.getCoveredText().equals(br2.getCoveredText()))
                continue;

            int br1id = parseInt(br1.getEntityId());
            int br2id = parseInt(br2.getEntityId());
            // filter out "brain"
            if (br1id == 21 || br2id == 21)
                continue;

            if (br1id < br2id)
                pairs.add(new Pair<BrainRegionDictTerm, BrainRegionDictTerm>(
                        br1, br2));
            else
                pairs.add(new Pair<BrainRegionDictTerm, BrainRegionDictTerm>(
                        br2, br1));
        }

        return pairs;
    }
public static List < Pair < BrainRegionDictTerm , BrainRegionDictTerm > > combinaisonPairs ( Collection < BrainRegionDictTerm > br ) { List < Pair < BrainRegionDictTerm , BrainRegionDictTerm > > pairs = newArrayList ( ) ; if ( br == null || br . size ( ) < 2 ) return pairs ; ICombinatoricsVector < BrainRegionDictTerm > initialVector = Factory . createVector ( br ) ; Generator < BrainRegionDictTerm > gen = Factory . createSimpleCombinationGenerator ( initialVector , 2 ) ; for ( ICombinatoricsVector < BrainRegionDictTerm > combination : gen ) { BrainRegionDictTerm br1 = combination . getValue ( 0 ) ; BrainRegionDictTerm br2 = combination . getValue ( 1 ) ; if ( br1 . getCoveredText ( ) . equals ( br2 . getCoveredText ( ) ) ) continue ; int br1id = parseInt ( br1 . getEntityId ( ) ) ; int br2id = parseInt ( br2 . getEntityId ( ) ) ; if ( br1id == 21 || br2id == 21 ) continue ; if ( br1id < br2id ) pairs . add ( new Pair < BrainRegionDictTerm , BrainRegionDictTerm > ( br1 , br2 ) ) ; else pairs . add ( new Pair < BrainRegionDictTerm , BrainRegionDictTerm > ( br2 , br1 ) ) ; } return pairs ; }
@return all simple 2-combinaisons