test_class.file: display/renderbasic/src/test/java/org/openscience/cdk/renderer/generators/standard/AbbreviationLabelTest.java
test_class.identifier: AbbreviationLabelTest
test_case.body: @Test
      public void formatTBu() {
          List<String> tokens = Arrays.asList("tBu");
          List<AbbreviationLabel.FormattedText> texts = AbbreviationLabel.format(tokens);
          assertThat(texts.size(), is(2));
          assertThat(texts.get(0).text, is("t"));
          assertThat(texts.get(0).style, is(AbbreviationLabel.STYLE_ITALIC));
          assertThat(texts.get(1).text, is("Bu"));
          assertThat(texts.get(1).style, is(AbbreviationLabel.STYLE_NORMAL));
      }
test_case.class_method_signature: AbbreviationLabelTest.formatTBu()
test_case.full_signature: @Test public void formatTBu()
test_case.identifier: formatTBu
test_case.invocations: asList format assertThat size is assertThat get is assertThat get is assertThat get is assertThat get is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void formatTBu()
focal_class.declarator: MINUS_STRING = "\u2212"
focal_class.modifier: private static final
focal_class.original_string: private static final String MINUS_STRING = "\u2212";
focal_class.type: String
focal_class.var_name: MINUS_STRING
focal_class.declarator: PREFIX_LIST = new String[]{
              "n", "norm", "n-", "c", "cy", "cyc", "cyclo", "c-", "cy-", "cyc-", "i", "iso", "i-", "t", "tert", "t-", "s",
              "sec", "s-", "o", "ortho", "o-", "m", "meta", "m-", "p", "para", "p-", "1-", "2-", "3-", "4-", "5-", "6-",
              "7-", "8-", "9-"
      }
focal_class.modifier: private final static
focal_class.original_string: private final static String[] PREFIX_LIST = new String[]{
              "n", "norm", "n-", "c", "cy", "cyc", "cyclo", "c-", "cy-", "cyc-", "i", "iso", "i-", "t", "tert", "t-", "s",
              "sec", "s-", "o", "ortho", "o-", "m", "meta", "m-", "p", "para", "p-", "1-", "2-", "3-", "4-", "5-", "6-",
              "7-", "8-", "9-"
      };
focal_class.type: String[]
focal_class.var_name: PREFIX_LIST
focal_class.declarator: ITAL_PREFIX = new String[]{
              "n", "norm", "sec", "s", "tert", "t",
              "ortho", "o", "meta", "m", "para", "p"
      }
focal_class.modifier: private final static
focal_class.original_string: private final static String[] ITAL_PREFIX = new String[]{
              "n", "norm", "sec", "s", "tert", "t",
              "ortho", "o", "meta", "m", "para", "p"
      };
focal_class.type: String[]
focal_class.var_name: ITAL_PREFIX
focal_class.declarator: SYMBOL_LIST = new String[]{"acac", "Ace", "Acetyl", "Acyl", "Ad", "All", "Alloc", "Allyl", "Amyl", "AOC",
                                                               "BDMS", "Benzoyl", "Benzyl", "Bn", "BOC", "Boc", "BOM", "bpy", "Bromo", "Bs", "Bu", "But", "Butyl", "Bz", "Bzl",
                                                               "Car", "Cbz", "Chloro", "CoA", "Cy",
                                                               "dppf", "dppp", "dba", "D", "Dan", "Dansyl", "DEIPS", "DEM", "Dip", "Dmb", "DPA", "DTBMS",
                                                               "EE", "EOM", "Et", "Ethyl",
                                                               "Fluoro", "FMOC", "Fmoc", "Formyl",
                                                               "Heptyl", "Hexyl",
                                                               "Iodo", "IPDMS",
                                                               "Me", "MEM", "Mesityl", "Mesyl", "Methoxy", "Methyl", "MOM", "Ms",
                                                               "Nitro",
                                                               "Oct", "Octyl",
                                                               "PAB", "Pentyl", "Ph", "Phenyl", "Pivaloyl", "PMB", "Pro", "Propargyl", "Propyl", "Pv",
                                                               "R", "SEM",
                                                               "T", "TBS", "TBDMS", "Trt", "TBDPS", "TES", "Tf", "THP", "THPO", "TIPS", "TMS", "Tos", "Tol", "Tosyl", "Tr", "Troc",
                                                               "Vinyl", "Voc", "Z"}
focal_class.modifier: private final static
focal_class.original_string: private final static String[] SYMBOL_LIST = new String[]{"acac", "Ace", "Acetyl", "Acyl", "Ad", "All", "Alloc", "Allyl", "Amyl", "AOC",
                                                               "BDMS", "Benzoyl", "Benzyl", "Bn", "BOC", "Boc", "BOM", "bpy", "Bromo", "Bs", "Bu", "But", "Butyl", "Bz", "Bzl",
                                                               "Car", "Cbz", "Chloro", "CoA", "Cy",
                                                               "dppf", "dppp", "dba", "D", "Dan", "Dansyl", "DEIPS", "DEM", "Dip", "Dmb", "DPA", "DTBMS",
                                                               "EE", "EOM", "Et", "Ethyl",
                                                               "Fluoro", "FMOC", "Fmoc", "Formyl",
                                                               "Heptyl", "Hexyl",
                                                               "Iodo", "IPDMS",
                                                               "Me", "MEM", "Mesityl", "Mesyl", "Methoxy", "Methyl", "MOM", "Ms",
                                                               "Nitro",
                                                               "Oct", "Octyl",
                                                               "PAB", "Pentyl", "Ph", "Phenyl", "Pivaloyl", "PMB", "Pro", "Propargyl", "Propyl", "Pv",
                                                               "R", "SEM",
                                                               "T", "TBS", "TBDMS", "Trt", "TBDPS", "TES", "Tf", "THP", "THPO", "TIPS", "TMS", "Tos", "Tol", "Tosyl", "Tr", "Troc",
                                                               "Vinyl", "Voc", "Z"};
focal_class.type: String[]
focal_class.var_name: SYMBOL_LIST
focal_class.declarator: PREFIX_TRIE = new Trie()
focal_class.modifier: private static
focal_class.original_string: private static Trie PREFIX_TRIE = new Trie();
focal_class.type: Trie
focal_class.var_name: PREFIX_TRIE
focal_class.declarator: ITAL_PREFIX_TRIE = new Trie()
focal_class.modifier: private static
focal_class.original_string: private static Trie ITAL_PREFIX_TRIE = new Trie();
focal_class.type: Trie
focal_class.var_name: ITAL_PREFIX_TRIE
focal_class.declarator: SYMBOL_TRIE = new Trie()
focal_class.modifier: private static
focal_class.original_string: private static Trie SYMBOL_TRIE = new Trie();
focal_class.type: Trie
focal_class.var_name: SYMBOL_TRIE
focal_class.declarator: STYLE_NORMAL    = 0
focal_class.modifier: static
focal_class.original_string: static int STYLE_NORMAL    = 0;
focal_class.type: int
focal_class.var_name: STYLE_NORMAL
focal_class.declarator: STYLE_SUBSCRIPT = -1
focal_class.modifier: static
focal_class.original_string: static int STYLE_SUBSCRIPT = -1;
focal_class.type: int
focal_class.var_name: STYLE_SUBSCRIPT
focal_class.declarator: STYLE_SUPSCRIPT = +1
focal_class.modifier: static
focal_class.original_string: static int STYLE_SUPSCRIPT = +1;
focal_class.type: int
focal_class.var_name: STYLE_SUPSCRIPT
focal_class.declarator: STYLE_ITALIC    = 2
focal_class.modifier: static
focal_class.original_string: static int STYLE_ITALIC    = 2;
focal_class.type: int
focal_class.var_name: STYLE_ITALIC
focal_class.file: display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/AbbreviationLabel.java
focal_class.identifier: AbbreviationLabel
focal_class.class_method_signature: AbbreviationLabel.parse(String label, List<String> tokens)
focal_class.full_signature: static boolean parse(String label, List<String> tokens)
focal_class.identifier: parse
focal_class.modifiers: static
focal_class.parameters: (String label, List<String> tokens)
focal_class.return: boolean
focal_class.signature: boolean parse(String label, List<String> tokens)
focal_class.class_method_signature: AbbreviationLabel.failParse(String label, List<String> tokens)
focal_class.full_signature: private static boolean failParse(String label, List<String> tokens)
focal_class.identifier: failParse
focal_class.modifiers: private static
focal_class.parameters: (String label, List<String> tokens)
focal_class.return: boolean
focal_class.signature: boolean failParse(String label, List<String> tokens)
focal_class.class_method_signature: AbbreviationLabel.isNumber(String str)
focal_class.full_signature: private static boolean isNumber(String str)
focal_class.identifier: isNumber
focal_class.modifiers: private static
focal_class.parameters: (String str)
focal_class.return: boolean
focal_class.signature: boolean isNumber(String str)
focal_class.class_method_signature: AbbreviationLabel.reverse(List<String> tokens)
focal_class.full_signature: static void reverse(List<String> tokens)
focal_class.identifier: reverse
focal_class.modifiers: static
focal_class.parameters: (List<String> tokens)
focal_class.return: void
focal_class.signature: void reverse(List<String> tokens)
focal_class.class_method_signature: AbbreviationLabel.format(List<String> tokens)
focal_class.full_signature: static List<FormattedText> format(List<String> tokens)
focal_class.identifier: format
focal_class.modifiers: static
focal_class.parameters: (List<String> tokens)
focal_class.return: List<FormattedText>
focal_class.signature: List<FormattedText> format(List<String> tokens)
focal_class.class_method_signature: AbbreviationLabel.reduce(List<FormattedText> texts, int from, int to)
focal_class.full_signature: static void reduce(List<FormattedText> texts, int from, int to)
focal_class.identifier: reduce
focal_class.modifiers: static
focal_class.parameters: (List<FormattedText> texts, int from, int to)
focal_class.return: void
focal_class.signature: void reduce(List<FormattedText> texts, int from, int to)
focal_class.class_method_signature: AbbreviationLabel.isChargeToken(String token)
focal_class.full_signature: private static boolean isChargeToken(String token)
focal_class.identifier: isChargeToken
focal_class.modifiers: private static
focal_class.parameters: (String token)
focal_class.return: boolean
focal_class.signature: boolean isChargeToken(String token)
focal_class.class_method_signature: AbbreviationLabel.isDigit(char c)
focal_class.full_signature: private static boolean isDigit(char c)
focal_class.identifier: isDigit
focal_class.modifiers: private static
focal_class.parameters: (char c)
focal_class.return: boolean
focal_class.signature: boolean isDigit(char c)
focal_class.class_method_signature: AbbreviationLabel.norm(char c)
focal_class.full_signature: private static char norm(char c)
focal_class.identifier: norm
focal_class.modifiers: private static
focal_class.parameters: (char c)
focal_class.return: char
focal_class.signature: char norm(char c)
focal_class.class_method_signature: AbbreviationLabel.findPrefix(Trie trie, String string, int i, int best)
focal_class.full_signature: private static int findPrefix(Trie trie, String string, int i, int best)
focal_class.identifier: findPrefix
focal_class.modifiers: private static
focal_class.parameters: (Trie trie, String string, int i, int best)
focal_class.return: int
focal_class.signature: int findPrefix(Trie trie, String string, int i, int best)
focal_class.class_method_signature: AbbreviationLabel.insert(Trie trie, String str, int i)
focal_class.full_signature: private static Trie insert(Trie trie, String str, int i)
focal_class.identifier: insert
focal_class.modifiers: private static
focal_class.parameters: (Trie trie, String str, int i)
focal_class.return: Trie
focal_class.signature: Trie insert(Trie trie, String str, int i)
focal_method.body: static List<FormattedText> format(List<String> tokens) {
          List<FormattedText> texts = new ArrayList<>(2 + tokens.size());
          for (String token : tokens) {
              // charges
              if (isChargeToken(token)) {
                  // charges are superscript
                  String sign = Character.toString(norm(token.charAt(0)));
                  String coef = token.length() > 1 ? token.substring(1) : "";
                  if (sign.equals("-")) sign = MINUS_STRING;
                  texts.add(new FormattedText(coef + sign, STYLE_SUPSCRIPT));
              }
              // subscript number after brackets
              else if (token.length() == 1 && isDigit(token.charAt(0)) && !texts.isEmpty() && texts.get(texts.size()-1).text.equals(")")) {
                  texts.add(new FormattedText(token, STYLE_SUBSCRIPT));
              }
              else {
                  // optional prefix
                  int i = findPrefix(ITAL_PREFIX_TRIE, token, 0, 0);
                  // find a numeric suffix to subscript
                  int j = token.length();
                  while (j > 0 && isDigit(token.charAt(j - 1)))
                      j--;
                  // check if we have numeric suffix
                  if (j > 0 && j < token.length()) {
                      if (i > j) i = 0; // prefix overlaps with suffix so don't use it
                      if (i > 0)
                          texts.add(new FormattedText(token.substring(0, i), STYLE_ITALIC));
                      texts.add(new FormattedText(token.substring(i, j), STYLE_NORMAL));
                      texts.add(new FormattedText(token.substring(j), STYLE_SUBSCRIPT));
                  } else {
                      if (i > 0)
                          texts.add(new FormattedText(token.substring(0, i), STYLE_ITALIC));
                      texts.add(new FormattedText(token.substring(i), STYLE_NORMAL));
                  }
              }
          }
  
          return texts;
      }
focal_method.class_method_signature: AbbreviationLabel.format(List<String> tokens)
focal_method.full_signature: static List<FormattedText> format(List<String> tokens)
focal_method.identifier: format
focal_method.invocations: size isChargeToken toString norm charAt length substring equals add length isDigit charAt isEmpty equals get size add findPrefix length isDigit charAt length add substring add substring add substring add substring add substring
focal_method.modifiers: static
focal_method.parameters: (List<String> tokens)
focal_method.return: List<FormattedText>
focal_method.signature: List<FormattedText> format(List<String> tokens)