test_class.declarator: sb
test_class.modifier: private
test_class.original_string: private StringBuilder sb;
test_class.type: StringBuilder
test_class.var_name: sb
test_class.file: strings/src/test/java/org/cthul/strings/JavaNamesTest.java
test_class.identifier: JavaNamesTest
test_case.body: @Test
      public void test_tokenize() {
          assertThat(tokenize("hello"), isArray("hello"));
          assertThat(tokenize("helloWorld"), isArray("hello", "World"));
          assertThat(tokenize("hello_World"), isArray("hello", "World"));
          assertThat(tokenize("HTTPRequest"), isArray("HTTP", "Request"));
          
          assertThat(tokenize("HE_wo"), isArray("HE", "wo"));
      }
test_case.class_method_signature: JavaNamesTest.test_tokenize()
test_case.full_signature: @Test public void test_tokenize()
test_case.identifier: test_tokenize
test_case.invocations: assertThat tokenize isArray assertThat tokenize isArray assertThat tokenize isArray assertThat tokenize isArray assertThat tokenize isArray
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test_tokenize()
focal_class.file: strings/src/main/java/org/cthul/strings/JavaNames.java
focal_class.identifier: JavaNames
focal_class.class_method_signature: JavaNames.add(List<String> list, int start, int end, String s)
focal_class.full_signature: private static void add(List<String> list, int start, int end, String s)
focal_class.identifier: add
focal_class.modifiers: private static
focal_class.parameters: (List<String> list, int start, int end, String s)
focal_class.return: void
focal_class.signature: void add(List<String> list, int start, int end, String s)
focal_class.class_method_signature: JavaNames.tokenize(final String s)
focal_class.full_signature: public static String[] tokenize(final String s)
focal_class.identifier: tokenize
focal_class.modifiers: public static
focal_class.parameters: (final String s)
focal_class.return: String[]
focal_class.signature: String[] tokenize(final String s)
focal_class.class_method_signature: JavaNames.firstToUpper(String s)
focal_class.full_signature: public static String firstToUpper(String s)
focal_class.identifier: firstToUpper
focal_class.modifiers: public static
focal_class.parameters: (String s)
focal_class.return: String
focal_class.signature: String firstToUpper(String s)
focal_class.class_method_signature: JavaNames.appendFirstToUpper(StringBuilder target, String s)
focal_class.full_signature: public static StringBuilder appendFirstToUpper(StringBuilder target, String s)
focal_class.identifier: appendFirstToUpper
focal_class.modifiers: public static
focal_class.parameters: (StringBuilder target, String s)
focal_class.return: StringBuilder
focal_class.signature: StringBuilder appendFirstToUpper(StringBuilder target, String s)
focal_class.class_method_signature: JavaNames.allToLower(final String... tokens)
focal_class.full_signature: public static String[] allToLower(final String... tokens)
focal_class.identifier: allToLower
focal_class.modifiers: public static
focal_class.parameters: (final String... tokens)
focal_class.return: String[]
focal_class.signature: String[] allToLower(final String... tokens)
focal_class.class_method_signature: JavaNames.allToUpper(final String... tokens)
focal_class.full_signature: public static String[] allToUpper(final String... tokens)
focal_class.identifier: allToUpper
focal_class.modifiers: public static
focal_class.parameters: (final String... tokens)
focal_class.return: String[]
focal_class.signature: String[] allToUpper(final String... tokens)
focal_class.class_method_signature: JavaNames.allToCamel(final String... tokens)
focal_class.full_signature: public static String[] allToCamel(final String... tokens)
focal_class.identifier: allToCamel
focal_class.modifiers: public static
focal_class.parameters: (final String... tokens)
focal_class.return: String[]
focal_class.signature: String[] allToCamel(final String... tokens)
focal_class.class_method_signature: JavaNames.camelCase(String string)
focal_class.full_signature: public static String camelCase(String string)
focal_class.identifier: camelCase
focal_class.modifiers: public static
focal_class.parameters: (String string)
focal_class.return: String
focal_class.signature: String camelCase(String string)
focal_class.class_method_signature: JavaNames.CamelCase(String string)
focal_class.full_signature: public static String CamelCase(String string)
focal_class.identifier: CamelCase
focal_class.modifiers: public static
focal_class.parameters: (String string)
focal_class.return: String
focal_class.signature: String CamelCase(String string)
focal_class.class_method_signature: JavaNames.camelCase(boolean firstToLower, String string)
focal_class.full_signature: private static String camelCase(boolean firstToLower, String string)
focal_class.identifier: camelCase
focal_class.modifiers: private static
focal_class.parameters: (boolean firstToLower, String string)
focal_class.return: String
focal_class.signature: String camelCase(boolean firstToLower, String string)
focal_class.class_method_signature: JavaNames.camelCase(final StringBuilder target, boolean firstToLower, final String... tokens)
focal_class.full_signature: public static StringBuilder camelCase(final StringBuilder target, boolean firstToLower, final String... tokens)
focal_class.identifier: camelCase
focal_class.modifiers: public static
focal_class.parameters: (final StringBuilder target, boolean firstToLower, final String... tokens)
focal_class.return: StringBuilder
focal_class.signature: StringBuilder camelCase(final StringBuilder target, boolean firstToLower, final String... tokens)
focal_class.class_method_signature: JavaNames.under_score(final StringBuilder sb, final String... tokens)
focal_class.full_signature: public static StringBuilder under_score(final StringBuilder sb, final String... tokens)
focal_class.identifier: under_score
focal_class.modifiers: public static
focal_class.parameters: (final StringBuilder sb, final String... tokens)
focal_class.return: StringBuilder
focal_class.signature: StringBuilder under_score(final StringBuilder sb, final String... tokens)
focal_class.class_method_signature: JavaNames.UNDER_SCORE(final StringBuilder sb, final String... tokens)
focal_class.full_signature: public static StringBuilder UNDER_SCORE(final StringBuilder sb, final String... tokens)
focal_class.identifier: UNDER_SCORE
focal_class.modifiers: public static
focal_class.parameters: (final StringBuilder sb, final String... tokens)
focal_class.return: StringBuilder
focal_class.signature: StringBuilder UNDER_SCORE(final StringBuilder sb, final String... tokens)
focal_class.class_method_signature: JavaNames.under_score(String string)
focal_class.full_signature: public static String under_score(String string)
focal_class.identifier: under_score
focal_class.modifiers: public static
focal_class.parameters: (String string)
focal_class.return: String
focal_class.signature: String under_score(String string)
focal_class.class_method_signature: JavaNames.UNDER_SCORE(String string)
focal_class.full_signature: public static String UNDER_SCORE(String string)
focal_class.identifier: UNDER_SCORE
focal_class.modifiers: public static
focal_class.parameters: (String string)
focal_class.return: String
focal_class.signature: String UNDER_SCORE(String string)
focal_method.body: public static String[] tokenize(final String s) {
          final List<String> result = new ArrayList<>();
          
          int start = 0;                  // start of current token
          boolean uppercaseToken = false; // if current token is all uppercase
          for (int i = 0; i < s.length(); i++) {
              char c = s.charAt(i);
              if (! Character.isJavaIdentifierPart(c) ||
                  (result.isEmpty() && start == i &&
                      !Character.isJavaIdentifierStart(c))) {
                  // This character should not appear in a Java name at all,
                  // or this would be the first character of the result, 
                  //    but it is not valid here.
                  // Treat it as a separator.
                  c = '_';
              }
              if (Character.isLowerCase(c) || Character.isDigit(c)) {
                  // the token goes on, unless it's all uppercase
                  if (uppercaseToken) {
                      // uppercase token ends here. The last uppercase
                      // character already was part of the next token.
                      add(result, start, i-1, s);
                      start = i-1;
                      // this is no uppercase token
                      uppercaseToken = false;
                  }
              } else if (Character.isUpperCase(c)) {
                  if (!uppercaseToken) {
                      // token ends here, new token starts
                      add(result, start, i, s);
                      start = i;
                  }
                  if (start == i) {
                      // first character is uppercase, this has potential for
                      // being an uppercase token, such as "HTTP"
                      uppercaseToken = true;
                  } else {
                      assert uppercaseToken : "token should be uppercase";
                  }
              } else { // c == '_'
                  // token ends here, next char is start of next token
                  add(result, start, i, s);
                  start = i+1;
                  // if this was an uppercase token, it ends now anyway
                  uppercaseToken = false;
              }
          }
          // add last token
          add(result, start, s.length(), s);
  
          return result.toArray(new String[result.size()]);
      }
focal_method.class_method_signature: JavaNames.tokenize(final String s)
focal_method.full_signature: public static String[] tokenize(final String s)
focal_method.identifier: tokenize
focal_method.invocations: length charAt isJavaIdentifierPart isEmpty isJavaIdentifierStart isLowerCase isDigit add isUpperCase add add add length toArray size
focal_method.modifiers: public static
focal_method.parameters: (final String s)
focal_method.return: String[]
focal_method.signature: String[] tokenize(final String s)