test_class.file: singa-chemistry/src/test/java/bio/singa/chemistry/features/smiles/SmilesParserTest.java
test_class.identifier: SmilesParserTest
test_case.body: @Test
      @DisplayName("smiles parsing - disconnected molecules")
      void shouldParseUnconnectedMolecule() {
          // O.O.O.O.O.O.O.O.O.O.O.O.[Al+3].[K+].[O-]S([O-])(=O)=O.[O-]S([O-])(=O)=O
          String smilesString = "O.O.O.O.O.O.O.O.O.O.O.O.[Al+3].[K+].[O-]S([O-])(=O)=O.[O-]S([O-])(=O)=O";
          MoleculeGraph moleculeGraph = SmilesParser.parse(smilesString);
          // O:0 has no neighbours
          assertEquals(moleculeGraph.getNode(0).getNeighbours().size(), 0);
          // Al:12 has no neighbours
          assertEquals(moleculeGraph.getNode(12).getNeighbours().size(), 0);
          // S:15 has 4 neighbours
          assertEquals(moleculeGraph.getNode(15).getNeighbours().size(), 4);
      }
test_case.class_method_signature: SmilesParserTest.shouldParseUnconnectedMolecule()
test_case.full_signature: @Test @DisplayName("smiles parsing - disconnected molecules") void shouldParseUnconnectedMolecule()
test_case.identifier: shouldParseUnconnectedMolecule
test_case.invocations: parse assertEquals size getNeighbours getNode assertEquals size getNeighbours getNode assertEquals size getNeighbours getNode
test_case.modifiers: @Test @DisplayName("smiles parsing - disconnected molecules")
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldParseUnconnectedMolecule()
focal_class.declarator: logger = LoggerFactory.getLogger(SmilesParser.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(SmilesParser.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: symbols
focal_class.modifier: private final
focal_class.original_string: private final Queue<Character> symbols;
focal_class.type: Queue<Character>
focal_class.var_name: symbols
focal_class.declarator: tokens
focal_class.modifier: private final
focal_class.original_string: private final List<String> tokens;
focal_class.type: List<String>
focal_class.var_name: tokens
focal_class.declarator: molecule
focal_class.modifier: private final
focal_class.original_string: private final MoleculeGraph molecule;
focal_class.type: MoleculeGraph
focal_class.var_name: molecule
focal_class.declarator: connectors
focal_class.modifier: private final
focal_class.original_string: private final HashMap<Pair<Integer>, CovalentBondType> connectors;
focal_class.type: HashMap<Pair<Integer>, CovalentBondType>
focal_class.var_name: connectors
focal_class.declarator: ringClosures
focal_class.modifier: private final
focal_class.original_string: private final HashMap<Integer, Integer> ringClosures;
focal_class.type: HashMap<Integer, Integer>
focal_class.var_name: ringClosures
focal_class.declarator: hydrogens
focal_class.modifier: private final
focal_class.original_string: private final List<Integer> hydrogens;
focal_class.type: List<Integer>
focal_class.var_name: hydrogens
focal_class.declarator: branches
focal_class.modifier: private final
focal_class.original_string: private final Deque<Integer> branches;
focal_class.type: Deque<Integer>
focal_class.var_name: branches
focal_class.declarator: currentSymbol
focal_class.modifier: private
focal_class.original_string: private Character currentSymbol;
focal_class.type: Character
focal_class.var_name: currentSymbol
focal_class.declarator: currentToken
focal_class.modifier: private
focal_class.original_string: private String currentToken;
focal_class.type: String
focal_class.var_name: currentToken
focal_class.declarator: currentIdentifer = Integer.MIN_VALUE
focal_class.modifier: private
focal_class.original_string: private int currentIdentifer = Integer.MIN_VALUE;
focal_class.type: int
focal_class.var_name: currentIdentifer
focal_class.declarator: currentMassNumber
focal_class.modifier: private
focal_class.original_string: private int currentMassNumber;
focal_class.type: int
focal_class.var_name: currentMassNumber
focal_class.declarator: currentCharge
focal_class.modifier: private
focal_class.original_string: private int currentCharge;
focal_class.type: int
focal_class.var_name: currentCharge
focal_class.declarator: currentElement
focal_class.modifier: private
focal_class.original_string: private Element currentElement;
focal_class.type: Element
focal_class.var_name: currentElement
focal_class.declarator: currentBondType
focal_class.modifier: private
focal_class.original_string: private CovalentBondType currentBondType;
focal_class.type: CovalentBondType
focal_class.var_name: currentBondType
focal_class.declarator: firstAtomInBranch = false
focal_class.modifier: private
focal_class.original_string: private boolean firstAtomInBranch = false;
focal_class.type: boolean
focal_class.var_name: firstAtomInBranch
focal_class.declarator: sameChainReference
focal_class.modifier: private
focal_class.original_string: private boolean sameChainReference;
focal_class.type: boolean
focal_class.var_name: sameChainReference
focal_class.file: singa-chemistry/src/main/java/bio/singa/chemistry/features/smiles/SmilesParser.java
focal_class.identifier: SmilesParser
focal_class.class_method_signature: SmilesParser.SmilesParser()
focal_class.full_signature: public  SmilesParser()
focal_class.identifier: SmilesParser
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  SmilesParser()
focal_class.class_method_signature: SmilesParser.parse(String smilesString)
focal_class.full_signature: public static MoleculeGraph parse(String smilesString)
focal_class.identifier: parse
focal_class.modifiers: public static
focal_class.parameters: (String smilesString)
focal_class.return: MoleculeGraph
focal_class.signature: MoleculeGraph parse(String smilesString)
focal_class.class_method_signature: SmilesParser.parseSmiles()
focal_class.full_signature: private boolean parseSmiles()
focal_class.identifier: parseSmiles
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean parseSmiles()
focal_class.class_method_signature: SmilesParser.parseAtom()
focal_class.full_signature: private boolean parseAtom()
focal_class.identifier: parseAtom
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean parseAtom()
focal_class.class_method_signature: SmilesParser.parseBranch()
focal_class.full_signature: private boolean parseBranch()
focal_class.identifier: parseBranch
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean parseBranch()
focal_class.class_method_signature: SmilesParser.parseChain()
focal_class.full_signature: private boolean parseChain()
focal_class.identifier: parseChain
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean parseChain()
focal_class.class_method_signature: SmilesParser.parseBond()
focal_class.full_signature: private boolean parseBond()
focal_class.identifier: parseBond
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean parseBond()
focal_class.class_method_signature: SmilesParser.parseRingClosure()
focal_class.full_signature: private boolean parseRingClosure()
focal_class.identifier: parseRingClosure
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean parseRingClosure()
focal_class.class_method_signature: SmilesParser.parseOrganicSymbol(boolean addLater)
focal_class.full_signature: private boolean parseOrganicSymbol(boolean addLater)
focal_class.identifier: parseOrganicSymbol
focal_class.modifiers: private
focal_class.parameters: (boolean addLater)
focal_class.return: boolean
focal_class.signature: boolean parseOrganicSymbol(boolean addLater)
focal_class.class_method_signature: SmilesParser.handleAtom(boolean addLater)
focal_class.full_signature: private void handleAtom(boolean addLater)
focal_class.identifier: handleAtom
focal_class.modifiers: private
focal_class.parameters: (boolean addLater)
focal_class.return: void
focal_class.signature: void handleAtom(boolean addLater)
focal_class.class_method_signature: SmilesParser.parseAromaticSymbol(boolean addLater)
focal_class.full_signature: private boolean parseAromaticSymbol(boolean addLater)
focal_class.identifier: parseAromaticSymbol
focal_class.modifiers: private
focal_class.parameters: (boolean addLater)
focal_class.return: boolean
focal_class.signature: boolean parseAromaticSymbol(boolean addLater)
focal_class.class_method_signature: SmilesParser.parseAtomSpecification()
focal_class.full_signature: private boolean parseAtomSpecification()
focal_class.identifier: parseAtomSpecification
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean parseAtomSpecification()
focal_class.class_method_signature: SmilesParser.parseIsotope()
focal_class.full_signature: private boolean parseIsotope()
focal_class.identifier: parseIsotope
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean parseIsotope()
focal_class.class_method_signature: SmilesParser.parseAromaticSeleniumAndArsenic()
focal_class.full_signature: private boolean parseAromaticSeleniumAndArsenic()
focal_class.identifier: parseAromaticSeleniumAndArsenic
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean parseAromaticSeleniumAndArsenic()
focal_class.class_method_signature: SmilesParser.parseElementSymbol()
focal_class.full_signature: private boolean parseElementSymbol()
focal_class.identifier: parseElementSymbol
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean parseElementSymbol()
focal_class.class_method_signature: SmilesParser.parseChirality()
focal_class.full_signature: private boolean parseChirality()
focal_class.identifier: parseChirality
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean parseChirality()
focal_class.class_method_signature: SmilesParser.parseHCount()
focal_class.full_signature: private boolean parseHCount()
focal_class.identifier: parseHCount
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean parseHCount()
focal_class.class_method_signature: SmilesParser.parseCharge()
focal_class.full_signature: private boolean parseCharge()
focal_class.identifier: parseCharge
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean parseCharge()
focal_class.class_method_signature: SmilesParser.parseChargeNumber()
focal_class.full_signature: private String parseChargeNumber()
focal_class.identifier: parseChargeNumber
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String parseChargeNumber()
focal_class.class_method_signature: SmilesParser.setCharge(String chargeToken)
focal_class.full_signature: private void setCharge(String chargeToken)
focal_class.identifier: setCharge
focal_class.modifiers: private
focal_class.parameters: (String chargeToken)
focal_class.return: void
focal_class.signature: void setCharge(String chargeToken)
focal_class.class_method_signature: SmilesParser.parseClass()
focal_class.full_signature: private boolean parseClass()
focal_class.identifier: parseClass
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean parseClass()
focal_class.class_method_signature: SmilesParser.setNextBond()
focal_class.full_signature: private void setNextBond()
focal_class.identifier: setNextBond
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void setNextBond()
focal_class.class_method_signature: SmilesParser.connectConsecutiveAtoms()
focal_class.full_signature: private void connectConsecutiveAtoms()
focal_class.identifier: connectConsecutiveAtoms
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void connectConsecutiveAtoms()
focal_class.class_method_signature: SmilesParser.connectHydrogens(int hydrogenCount)
focal_class.full_signature: private void connectHydrogens(int hydrogenCount)
focal_class.identifier: connectHydrogens
focal_class.modifiers: private
focal_class.parameters: (int hydrogenCount)
focal_class.return: void
focal_class.signature: void connectHydrogens(int hydrogenCount)
focal_class.class_method_signature: SmilesParser.addRingClosure()
focal_class.full_signature: private void addRingClosure()
focal_class.identifier: addRingClosure
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void addRingClosure()
focal_class.class_method_signature: SmilesParser.isEmpty()
focal_class.full_signature: private boolean isEmpty()
focal_class.identifier: isEmpty
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isEmpty()
focal_class.class_method_signature: SmilesParser.isInRage(Character rangeStart, Character rangeEnd)
focal_class.full_signature: private boolean isInRage(Character rangeStart, Character rangeEnd)
focal_class.identifier: isInRage
focal_class.modifiers: private
focal_class.parameters: (Character rangeStart, Character rangeEnd)
focal_class.return: boolean
focal_class.signature: boolean isInRage(Character rangeStart, Character rangeEnd)
focal_class.class_method_signature: SmilesParser.isNonZeroDecimal()
focal_class.full_signature: private boolean isNonZeroDecimal()
focal_class.identifier: isNonZeroDecimal
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isNonZeroDecimal()
focal_class.class_method_signature: SmilesParser.isDecimal()
focal_class.full_signature: private boolean isDecimal()
focal_class.identifier: isDecimal
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isDecimal()
focal_class.class_method_signature: SmilesParser.isLowerCaseWordCharacter()
focal_class.full_signature: private boolean isLowerCaseWordCharacter()
focal_class.identifier: isLowerCaseWordCharacter
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isLowerCaseWordCharacter()
focal_class.class_method_signature: SmilesParser.isUpperCaseWordCharacter()
focal_class.full_signature: private boolean isUpperCaseWordCharacter()
focal_class.identifier: isUpperCaseWordCharacter
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isUpperCaseWordCharacter()
focal_class.class_method_signature: SmilesParser.addToCurrentToken()
focal_class.full_signature: private void addToCurrentToken()
focal_class.identifier: addToCurrentToken
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void addToCurrentToken()
focal_class.class_method_signature: SmilesParser.addThisAndNext()
focal_class.full_signature: private void addThisAndNext()
focal_class.identifier: addThisAndNext
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void addThisAndNext()
focal_class.class_method_signature: SmilesParser.addToTokens()
focal_class.full_signature: private void addToTokens()
focal_class.identifier: addToTokens
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void addToTokens()
focal_class.class_method_signature: SmilesParser.addAndClearCurrentToken()
focal_class.full_signature: private void addAndClearCurrentToken()
focal_class.identifier: addAndClearCurrentToken
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void addAndClearCurrentToken()
focal_class.class_method_signature: SmilesParser.poll()
focal_class.full_signature: private void poll()
focal_class.identifier: poll
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void poll()
focal_class.class_method_signature: SmilesParser.dispose()
focal_class.full_signature: private void dispose()
focal_class.identifier: dispose
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void dispose()
focal_class.class_method_signature: SmilesParser.addAtomToGraph(char atom)
focal_class.full_signature: private void addAtomToGraph(char atom)
focal_class.identifier: addAtomToGraph
focal_class.modifiers: private
focal_class.parameters: (char atom)
focal_class.return: void
focal_class.signature: void addAtomToGraph(char atom)
focal_class.class_method_signature: SmilesParser.addAtomToGraph(String atom)
focal_class.full_signature: private void addAtomToGraph(String atom)
focal_class.identifier: addAtomToGraph
focal_class.modifiers: private
focal_class.parameters: (String atom)
focal_class.return: void
focal_class.signature: void addAtomToGraph(String atom)
focal_class.class_method_signature: SmilesParser.addAtom()
focal_class.full_signature: private void addAtom()
focal_class.identifier: addAtom
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void addAtom()
focal_class.class_method_signature: SmilesParser.openBranch()
focal_class.full_signature: private void openBranch()
focal_class.identifier: openBranch
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void openBranch()
focal_class.class_method_signature: SmilesParser.closeBranch()
focal_class.full_signature: private void closeBranch()
focal_class.identifier: closeBranch
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void closeBranch()
focal_method.body: public static MoleculeGraph parse(String smilesString) {
          logger.info("parsing smiles string {} ", smilesString);
          SmilesParser parser = new SmilesParser();
          // extract symbols
          for (char aChar : smilesString.toCharArray()) {
              parser.symbols.add(aChar);
          }
          // poll the first symbol
          parser.currentSymbol = parser.symbols.poll();
          // try to parse the string
          while (!parser.symbols.isEmpty()) {
              if (!parser.parseSmiles()) {
                  throw new IllegalArgumentException("The given string is no valid SMILES String (Exception was thrown" +
                          " after " + parser.tokens + " have been parsed).");
              }
          }
  
          // add hydrogens to connectors
          parser.hydrogens.forEach((identifier) -> {
              int hydrogenIdentifier = parser.molecule.addNextAtom("H");
              parser.connectors.put(new Pair<>(identifier, hydrogenIdentifier), CovalentBondType.SINGLE_BOND);
          });
  
          // add bonds
          parser.connectors.forEach((connector, type) -> {
              if (type != CovalentBondType.UNCONNECTED) {
                  parser.molecule.addEdgeBetween(parser.molecule.getNode(connector.getFirst()),
                          parser.molecule.getNode(connector.getSecond()), type);
              }
          });
  
          // transform aromatic bonds to double bonds
  
          return parser.molecule;
  
      }
focal_method.class_method_signature: SmilesParser.parse(String smilesString)
focal_method.full_signature: public static MoleculeGraph parse(String smilesString)
focal_method.identifier: parse
focal_method.invocations: info toCharArray add poll isEmpty parseSmiles forEach addNextAtom put forEach addEdgeBetween getNode getFirst getNode getSecond
focal_method.modifiers: public static
focal_method.parameters: (String smilesString)
focal_method.return: MoleculeGraph
focal_method.signature: MoleculeGraph parse(String smilesString)