1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| public static List<G2> getG2For(int topRight, int topLeft, int leftTop, int leftBot, int botLeft, int botRight, int rightBot, int rightTop) {
if (topRight != FREE && topLeft != FREE && leftTop != FREE && leftBot != FREE) {
if (botLeft == FREE && botRight == FREE && rightBot == FREE && rightTop == FREE) {
return indexG2TopLeft[topRight][topLeft][leftTop][leftBot];
}
// Cela évite d'avoir des merge de liste trop long quand il y a trop de dégrée de liberté. Donne des listes de 800 éléments max à merger à la place de 25000.
if(botLeft == FREE && botRight == FREE ){
return mergeListG2(indexG2TopLeft[topRight][topLeft][leftTop][leftBot], indexG2LeftRight[leftTop][leftBot][rightBot][rightTop]);
}
// La réciproque du teste d'avant.
if(rightBot == FREE && rightTop == FREE ){
return mergeListG2(indexG2TopLeft[topRight][topLeft][leftTop][leftBot], indexG2LeftBot[leftTop][leftBot][botLeft][botRight]);
}
// Si on a vraiment besoin de faire le merge sur les deux liste
return mergeListG2( indexG2TopLeft[topRight][topLeft][leftTop][leftBot],indexG2BotRight[botLeft][botRight][rightBot][rightTop]);
} (
// Le reste est une suite de permutations équivalentes pour les autres côtés.
// Dans mon implémentation si il n'y a pas au moins 4 contraintes (2 côtes), il y a une exception, car le résultat est sans intérêt pour ma problématique. Mais, la plus part des cas son traitable simplement et rapidement. (ie : Pas de merge lourd.)
} |