Class RDFileParser


  • public class RDFileParser
    extends java.lang.Object
    Quick and dirty RD-File parser that reads non-hierarchical RD-Files.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String cNewLineString  
    • Constructor Summary

      Constructors 
      Constructor Description
      RDFileParser​(java.io.File file)  
      RDFileParser​(java.io.Reader reader)  
      RDFileParser​(java.lang.String fileName)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getERegNo()  
      java.util.TreeMap<java.lang.String,​java.lang.String> getFieldData()  
      java.lang.String getFieldData​(java.lang.String key)  
      java.lang.String[] getFieldNames()
      Returns a list of field names.
      java.lang.String getIRegNo()  
      StereoMolecule getNextMolecule()
      RD-files may contains lists of molecules or lists of reactions.
      Reaction getNextReaction()
      RD-files may contains lists of molecules or lists of reactions.
      int getRowCount()
      Only accurate if getFieldNames() or getFieldNames(int) was called earlier and if the number of records of the SD-file is smaller than the number of records that were examined within the the getFieldNames() method.
      boolean hasNext()  
      boolean isMoleculeNext()  
      boolean isReactionNext()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RDFileParser

        public RDFileParser​(java.lang.String fileName)
      • RDFileParser

        public RDFileParser​(java.io.File file)
      • RDFileParser

        public RDFileParser​(java.io.Reader reader)
    • Method Detail

      • hasNext

        public boolean hasNext()
      • getRowCount

        public int getRowCount()
        Only accurate if getFieldNames() or getFieldNames(int) was called earlier and if the number of records of the SD-file is smaller than the number of records that were examined within the the getFieldNames() method. If not all records of the file were seen, then -1 is returned. For getRowCount() to reliably return the record count call getFieldNames(Integer.MAX_VALUE) first.
        Returns:
        number of rows or -1
      • getFieldData

        public java.util.TreeMap<java.lang.String,​java.lang.String> getFieldData()
      • getFieldData

        public java.lang.String getFieldData​(java.lang.String key)
      • getERegNo

        public java.lang.String getERegNo()
      • getIRegNo

        public java.lang.String getIRegNo()
      • getNextReaction

        public Reaction getNextReaction()
        RD-files may contains lists of molecules or lists of reactions. For RD-files containing reactions use this method.
        Returns:
        reaction or null, if the end of the file has been reached
      • isMoleculeNext

        public boolean isMoleculeNext()
      • isReactionNext

        public boolean isReactionNext()
      • getNextMolecule

        public StereoMolecule getNextMolecule()
        RD-files may contains lists of molecules or lists of reactions. For RD-files containing molecule use this method.
        Returns:
        molecule or null, if the end of the file has been reached
      • getFieldNames

        public java.lang.String[] getFieldNames()
        Returns a list of field names. If the field names were not passed to the constructor of SDFileParser, this method parses the file/reader to extract all field names and uses up this SDFileParser. In this case one needs to instantiate a new SDFileParser to sequentially iterate through the file/reader's records and supply the field name array to the constructor.
        Returns:
        array of field names