From c9cd534ba130858f7b447d673dd684866f55e34e Mon Sep 17 00:00:00 2001 From: "aurian.jault" Date: Thu, 2 Feb 2023 11:06:14 +0100 Subject: [PATCH] Algo de verification --- src/algo.js | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/src/algo.js b/src/algo.js index db0090e..07b58fc 100644 --- a/src/algo.js +++ b/src/algo.js @@ -11,8 +11,80 @@ * } * Check all length of matrice * for(i = 0; i tab + * for (j=0; j { + matrice.push(element.getAttribute()); + }); + // Idéalement check si toute les listes d'attributs sont de même taille + for (let i = 0; i < matrice[0]; i++) { + let listAttrib = [] + for (let j = 0; j < matrice[i]; j++) { + listAttrib.push(j); + } + if(!checkattrib(j)){ + return false; + } + return true; + } +} + + +function checkattrib(attribs){ + let orderingMethod = "null"; // Can only take ["null", "same", "different"] + attribs.forEach(function callback(value, index) + { + if(!index === attribs.length) + { + for (let i = index+1; i < array.length; i++) + { + if(attribs[i] === value) + { + if(orderingMethod === "null" || orderingMethod === "same") + { + orderingMethod = "same"; + } + else + { + return false; + } + } + else + { + if(orderingMethod === "null" || orderingMethod === "different") + { + orderingMethod = "different" + } + else + { + return false + } + } + + } + } + }); + return true; +}