Symbol { public static String java2Elisp(String javaName) { StringBuffer lispName = new StringBuffer(); boolean lastCharWasDash = false; char prev = ' '; for (int i = 0; i < javaName.length(); i++) { char c = javaName.charAt(i); if (!Character.isLetterOrDigit(c)) { lispName.append('-'); lastCharWasDash = true; } else { if (i > 0 && !lastCharWasDash && Character.isLetter(prev) && Character.isLetter(c) && Character.isLowerCase(prev) && Character.isUpperCase(c)) { lispName.append('-'); } lispName.append(Character.toLowerCase(c)); lastCharWasDash = false; } prev = c; } return lispName.toString(); } Symbol(String name); String getName(); String toString(); static String java2Elisp(String javaName);  }
@Test public void testJava2Elisp1() { assertEquals("jdee-foo-call-left-right", Symbol.java2Elisp("jdeeFooCallLeftRight")); }
@Test public void testJava2Elisp2() { assertEquals("jdee-foo-call-left-right", Symbol.java2Elisp("jdee.foo.Call.leftRight")); }
@Test public void testJava2Elisp3() { assertEquals("jdee-foo-call-left-right", Symbol.java2Elisp("jdee.foo.CALL_LEFT_RIGHT")); }