test_class.file: storage/inchi/src/test/java/org/openscience/cdk/graph/invariant/InChINumbersToolsTest.java
test_class.identifier: InChINumbersToolsTest
test_class.superclass: extends CDKTestCase
test_case.body: @Test
      public void parseStandard() throws Exception {
          assertThat(InChINumbersTools.parseUSmilesNumbers("AuxInfo=1/0/N:3,2,1/rA:3OCC/rB:s1;s2;/rC:;;;", mock(3)),
                  is(new long[]{3, 2, 1}));
      }
test_case.class_method_signature: InChINumbersToolsTest.parseStandard()
test_case.full_signature: @Test public void parseStandard()
test_case.identifier: parseStandard
test_case.invocations: assertThat parseUSmilesNumbers mock is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void parseStandard()
focal_class.file: storage/inchi/src/main/java/org/openscience/cdk/graph/invariant/InChINumbersTools.java
focal_class.identifier: InChINumbersTools
focal_class.class_method_signature: InChINumbersTools.getNumbers(IAtomContainer atomContainer)
focal_class.full_signature: public static long[] getNumbers(IAtomContainer atomContainer)
focal_class.identifier: getNumbers
focal_class.modifiers: public static
focal_class.parameters: (IAtomContainer atomContainer)
focal_class.return: long[]
focal_class.signature: long[] getNumbers(IAtomContainer atomContainer)
focal_class.class_method_signature: InChINumbersTools.parseAuxInfo(String aux, long[] numbers)
focal_class.full_signature: public static void parseAuxInfo(String aux, long[] numbers)
focal_class.identifier: parseAuxInfo
focal_class.modifiers: public static
focal_class.parameters: (String aux, long[] numbers)
focal_class.return: void
focal_class.signature: void parseAuxInfo(String aux, long[] numbers)
focal_class.class_method_signature: InChINumbersTools.getUSmilesNumbers(IAtomContainer container)
focal_class.full_signature: public static long[] getUSmilesNumbers(IAtomContainer container)
focal_class.identifier: getUSmilesNumbers
focal_class.modifiers: public static
focal_class.parameters: (IAtomContainer container)
focal_class.return: long[]
focal_class.signature: long[] getUSmilesNumbers(IAtomContainer container)
focal_class.class_method_signature: InChINumbersTools.parseUSmilesNumbers(String aux, IAtomContainer container)
focal_class.full_signature: static long[] parseUSmilesNumbers(String aux, IAtomContainer container)
focal_class.identifier: parseUSmilesNumbers
focal_class.modifiers: static
focal_class.parameters: (String aux, IAtomContainer container)
focal_class.return: long[]
focal_class.signature: long[] parseUSmilesNumbers(String aux, IAtomContainer container)
focal_class.class_method_signature: InChINumbersTools.exch(long[] values, int i, int j)
focal_class.full_signature: private static void exch(long[] values, int i, int j)
focal_class.identifier: exch
focal_class.modifiers: private static
focal_class.parameters: (long[] values, int i, int j)
focal_class.return: void
focal_class.signature: void exch(long[] values, int i, int j)
focal_class.class_method_signature: InChINumbersTools.findPiBondedOxygen(IAtomContainer container, IAtom atom)
focal_class.full_signature: private static IAtom findPiBondedOxygen(IAtomContainer container, IAtom atom)
focal_class.identifier: findPiBondedOxygen
focal_class.modifiers: private static
focal_class.parameters: (IAtomContainer container, IAtom atom)
focal_class.return: IAtom
focal_class.signature: IAtom findPiBondedOxygen(IAtomContainer container, IAtom atom)
focal_class.class_method_signature: InChINumbersTools.auxInfo(IAtomContainer container, INCHI_OPTION... options)
focal_class.full_signature: static String auxInfo(IAtomContainer container, INCHI_OPTION... options)
focal_class.identifier: auxInfo
focal_class.modifiers: static
focal_class.parameters: (IAtomContainer container, INCHI_OPTION... options)
focal_class.return: String
focal_class.signature: String auxInfo(IAtomContainer container, INCHI_OPTION... options)
focal_method.body: static long[] parseUSmilesNumbers(String aux, IAtomContainer container) {
  
          int index;
          long[] numbers = new long[container.getAtomCount()];
          int[] first = null;
          int label = 1;
  
          if ((index = aux.indexOf("/R:")) >= 0) { // reconnected metal numbers
              int endIndex = aux.indexOf('/', index + 8);
              if (endIndex<0)
                  endIndex = aux.length();
              String[] baseNumbers = aux.substring(index + 8, endIndex).split(";");
              first = new int[baseNumbers.length];
              Arrays.fill(first, -1);
              for (int i = 0; i < baseNumbers.length; i++) {
                  String[] numbering = baseNumbers[i].split(",");
                  first[i] = Integer.parseInt(numbering[0]) - 1;
                  for (String number : numbering) {
                      numbers[Integer.parseInt(number) - 1] = label++;
                  }
              }
          } else if ((index = aux.indexOf("/N:")) >= 0) { // standard numbers
  
              // read the standard numbers first (need to reference back for some structures)
              String[] baseNumbers = aux.substring(index + 3, aux.indexOf('/', index + 3)).split(";");
              first = new int[baseNumbers.length];
              Arrays.fill(first, -1);
  
              if ((index = aux.indexOf("/F:")) >= 0) {
                  String[] fixedHNumbers = aux.substring(index + 3, aux.indexOf('/', index + 3)).split(";");
                  for (int i = 0; i < fixedHNumbers.length; i++) {
                      String component = fixedHNumbers[i];
  
                      // m, 2m, 3m ... need to lookup number in the base numbering
                      if (component.charAt(component.length() - 1) == 'm') {
                          int n = component.length() > 1 ? Integer
                                  .parseInt(component.substring(0, component.length() - 1)) : 1;
                          for (int j = 0; j < n; j++) {
                              String[] numbering = baseNumbers[i + j].split(",");
                              first[i + j] = Integer.parseInt(numbering[0]) - 1;
                              for (String number : numbering)
                                  numbers[Integer.parseInt(number) - 1] = label++;
                          }
                      } else {
                          String[] numbering = component.split(",");
                          for (String number : numbering)
                              numbers[Integer.parseInt(number)-1] = label++;
                      }
                  }
              } else {
                  for (int i = 0; i < baseNumbers.length; i++) {
                      String[] numbering = baseNumbers[i].split(",");
                      first[i] = Integer.parseInt(numbering[0]) - 1;
                      for (String number : numbering)
                          numbers[Integer.parseInt(number) - 1] = label++;
                  }
              }
          } else {
              throw new IllegalArgumentException("AuxInfo did not contain extractable base numbers (/N: or /R:).");
          }
  
          // Rule E: swap any oxygen anion for a double bonded oxygen (InChI sees
          // them as equivalent)
          for (int v : first) {
              if (v >= 0) {
                  IAtom atom = container.getAtom(v);
                  if (atom.getFormalCharge() == null) continue;
                  if (atom.getAtomicNumber() == 8 && atom.getFormalCharge() == -1) {
                      List<IAtom> neighbors = container.getConnectedAtomsList(atom);
                      if (neighbors.size() == 1) {
                          IAtom correctedStart = findPiBondedOxygen(container, neighbors.get(0));
                          if (correctedStart != null) exch(numbers, v, container.indexOf(correctedStart));
                      }
                  }
              }
          }
  
          // assign unlabelled atoms
          for (int i = 0; i < numbers.length; i++)
              if (numbers[i] == 0) numbers[i] = label++;
  
          return numbers;
      }
focal_method.class_method_signature: InChINumbersTools.parseUSmilesNumbers(String aux, IAtomContainer container)
focal_method.full_signature: static long[] parseUSmilesNumbers(String aux, IAtomContainer container)
focal_method.identifier: parseUSmilesNumbers
focal_method.invocations: getAtomCount indexOf indexOf length split substring fill split parseInt parseInt indexOf split substring indexOf fill indexOf split substring indexOf charAt length length parseInt substring length split parseInt parseInt split parseInt split parseInt parseInt getAtom getFormalCharge getAtomicNumber getFormalCharge getConnectedAtomsList size findPiBondedOxygen get exch indexOf
focal_method.modifiers: static
focal_method.parameters: (String aux, IAtomContainer container)
focal_method.return: long[]
focal_method.signature: long[] parseUSmilesNumbers(String aux, IAtomContainer container)