@Test public void testToNormalizedSAN() { assertEquals("e3", toNormalizedSAN("e3")); assertEquals("e3", toNormalizedSAN("Pe3")); assertEquals("a8Q", toNormalizedSAN("a8Q")); assertEquals("a8Q", toNormalizedSAN("a8=Q")); assertEquals("Rd6", toNormalizedSAN("Rd6")); assertEquals("Rd6", toNormalizedSAN("Rd6?")); assertEquals("Rd6", toNormalizedSAN("Rd6!")); assertEquals("Rd6", toNormalizedSAN("Rd6!?")); assertEquals("Rd6", toNormalizedSAN("Rd6?!")); assertEquals("Rd6", toNormalizedSAN("Rd6!!")); assertEquals("Rd6", toNormalizedSAN("Rd6??")); assertEquals("Bc3", toNormalizedSAN("Bc3")); assertEquals("Bc3", toNormalizedSAN("B@c3")); }
public static String toNormalizedSAN(final String pChaine) { assert pChaine != null; final StringBuilder res = new StringBuilder(pChaine); if (res.charAt(0) == 'P') { res.deleteCharAt(0); } int p = res.indexOf("="); while (p >= 0) { res.deleteCharAt(p); p = res.indexOf("="); } while ((res.length() > 0) && ("?!".indexOf(res.charAt(res.length() - 1)) >= 0)) { res.deleteCharAt(res.length() - 1); } p = res.indexOf("@"); while (p >= 0) { res.deleteCharAt(p); p = res.indexOf("@"); } return res.toString(); }
PGNUtils { public static String toNormalizedSAN(final String pChaine) { assert pChaine != null; final StringBuilder res = new StringBuilder(pChaine); if (res.charAt(0) == 'P') { res.deleteCharAt(0); } int p = res.indexOf("="); while (p >= 0) { res.deleteCharAt(p); p = res.indexOf("="); } while ((res.length() > 0) && ("?!".indexOf(res.charAt(res.length() - 1)) >= 0)) { res.deleteCharAt(res.length() - 1); } p = res.indexOf("@"); while (p >= 0) { res.deleteCharAt(p); p = res.indexOf("@"); } return res.toString(); } }
PGNUtils { public static String toNormalizedSAN(final String pChaine) { assert pChaine != null; final StringBuilder res = new StringBuilder(pChaine); if (res.charAt(0) == 'P') { res.deleteCharAt(0); } int p = res.indexOf("="); while (p >= 0) { res.deleteCharAt(p); p = res.indexOf("="); } while ((res.length() > 0) && ("?!".indexOf(res.charAt(res.length() - 1)) >= 0)) { res.deleteCharAt(res.length() - 1); } p = res.indexOf("@"); while (p >= 0) { res.deleteCharAt(p); p = res.indexOf("@"); } return res.toString(); } private  PGNUtils(); }
PGNUtils { public static String toNormalizedSAN(final String pChaine) { assert pChaine != null; final StringBuilder res = new StringBuilder(pChaine); if (res.charAt(0) == 'P') { res.deleteCharAt(0); } int p = res.indexOf("="); while (p >= 0) { res.deleteCharAt(p); p = res.indexOf("="); } while ((res.length() > 0) && ("?!".indexOf(res.charAt(res.length() - 1)) >= 0)) { res.deleteCharAt(res.length() - 1); } p = res.indexOf("@"); while (p >= 0) { res.deleteCharAt(p); p = res.indexOf("@"); } return res.toString(); } private  PGNUtils(); static Game toGame(final BufferedReader pFlux); static String toNormalizedSAN(final String pChaine); static String toPGN(final Game pPartie); }
PGNUtils { public static String toNormalizedSAN(final String pChaine) { assert pChaine != null; final StringBuilder res = new StringBuilder(pChaine); if (res.charAt(0) == 'P') { res.deleteCharAt(0); } int p = res.indexOf("="); while (p >= 0) { res.deleteCharAt(p); p = res.indexOf("="); } while ((res.length() > 0) && ("?!".indexOf(res.charAt(res.length() - 1)) >= 0)) { res.deleteCharAt(res.length() - 1); } p = res.indexOf("@"); while (p >= 0) { res.deleteCharAt(p); p = res.indexOf("@"); } return res.toString(); } private  PGNUtils(); static Game toGame(final BufferedReader pFlux); static String toNormalizedSAN(final String pChaine); static String toPGN(final Game pPartie);  }