Index: lutinutil/src/java/org/codelutin/util/CardinalityHelper.java diff -u lutinutil/src/java/org/codelutin/util/CardinalityHelper.java:1.2 lutinutil/src/java/org/codelutin/util/CardinalityHelper.java:1.3 --- lutinutil/src/java/org/codelutin/util/CardinalityHelper.java:1.2 Sun Dec 30 22:29:46 2007 +++ lutinutil/src/java/org/codelutin/util/CardinalityHelper.java Wed Feb 13 20:54:09 2008 @@ -250,102 +250,4 @@ // do not instanciate } - } - -// /** -// * Parse la cardinalite à la fin d'un texte. -// * -// * TODO A améliorer. -// * -// * @param key la valeur dont on cherche la cardinalité -// * @param mandatory flag to say if this is a mandatory element or not. -// * @return un tableau contenant 3 object : le texte donné sans les -// * informations de cardinalité, la répétitionMin, la répétitionMax. -// */ -// public static Object[] parseCardinalite(String key, boolean mandatory) { -// Object[] result = new Object[3]; -// int repetitionMin; -// int repetitionMax; -// String cleanKey; -// -// if (key.endsWith("+")) { -// // cardinalité + = {1,-1} -// repetitionMin = 1; -// repetitionMax = -1; -// cleanKey = key.substring(0, key.length() - 1); -// } else { -// if (key.endsWith("*")) { -// // cardinalité * = {0,-1} -// repetitionMin = 0; -// repetitionMax = -1; -// cleanKey = key.substring(0, key.length() - 1); -// } else { -// if (key.endsWith("}")) { -// // cardinalité spécifiée -// int index = key.indexOf("{"); -// cleanKey = key.substring(0, index); -// String tmp = key.substring(index + 1, key.length() - 1); -// int comaIndex = tmp.indexOf(','); -// if (comaIndex == -1) { -// // cardinalité unique -// repetitionMax = repetitionMin = Integer.valueOf(tmp); -// } else { -// repetitionMin = Integer.valueOf(tmp.substring(0, comaIndex)); -// repetitionMax = Integer.valueOf(tmp.substring(comaIndex + 1)); -// } -// } else { -// // pas de cardinalité -// // rien à faire (on prend les valeurs par defaut) -// cleanKey = key; -// if (mandatory) { -// repetitionMin = 1; -// repetitionMax = 1; -// } else { -// repetitionMin = 0; -// repetitionMax = 1; -// } -// } -// } -// } -// result[0] = cleanKey.trim().toLowerCase(); -// result[1] = repetitionMin; -// result[2] = repetitionMax; -// return result; -// } - -//public static void printCardinalite(StringBuilder sb, String txt, int min, int max, boolean mandatory, String mo, String mc, String oo, String oc) { -// // flag pour indiquer s'il faut ou non imprimer les bordures -// boolean print = false; -// if (mandatory) { -// sb.append(mo).append(txt).append(mc); -// if (max == -1 && min == 1) { -// sb.append('+'); -// } else { -// if (max != 0 && min != 1) { -// print = true; -// } -// } -// } else { -// if (max == -1) { -// sb.append(oo).append(txt).append(oc); -// sb.append('*'); -// } else { -// if (max == 1 && min == 0) { -// sb.append(oo).append(txt).append(oc); -// } else { -// sb.append(mo).append(txt).append(mc); -// print = true; -// } -// } -// } -// if (print) { -// sb.append('{'); -// sb.append(min); -// if (max != min) { -// sb.append(','); -// sb.append(max == -1 ? '*' : max); -// } -// sb.append('}'); -// } -// }