Class SDFileParser

    • Constructor Detail

      • SDFileParser

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

        public SDFileParser​(java.lang.String fileName,
                            java.lang.String[] fieldName)
      • SDFileParser

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

        public SDFileParser​(java.io.File file,
                            java.lang.String[] fieldName)
      • SDFileParser

        public SDFileParser​(java.io.Reader reader)
      • SDFileParser

        public SDFileParser​(java.io.Reader reader,
                            java.lang.String[] fieldName)
    • Method Detail

      • 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.
        Specified by:
        getRowCount in class CompoundFileParser
        Returns:
        number of rows or -1
      • advanceToNext

        protected boolean advanceToNext()
        Description copied from class: CompoundFileParser
        Dont't call this method directly. Use next() instead.
        Specified by:
        advanceToNext in class CompoundFileParser
        Returns:
        false if there is no next row
      • getMolecule

        public StereoMolecule getMolecule()
        Description copied from class: CompoundFileParser
        Either this method or getIDCode() and getCoordinates() must be overwritten!!!
        Overrides:
        getMolecule in class CompoundFileParser
        Returns:
        the molecule of the current record (null in case of parsing error)
      • getMoleculeName

        public java.lang.String getMoleculeName()
        Specified by:
        getMoleculeName in class CompoundFileParser
        Returns:
        name/id of (primary) chemical structure of the current row
      • getNextMolFile

        public java.lang.String getNextMolFile()
        Returns the molfile of the current record as one big String as it was read from the input file. Line endings are '\n'.
        Returns:
      • getNextFieldData

        public java.lang.String getNextFieldData()
        Returns the field data of the current record as one big String as it was read from the input file. Line endings are '\n'.
        Returns:
      • 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.
        Specified by:
        getFieldNames in class CompoundFileParser
        Returns:
        array of field names
      • getFieldNames

        public java.lang.String[] getFieldNames​(int recordsToInspect)
        Returns a list of field names. If the field names were not passed to the constructor of SDFileParser, this method parses the file/reader records 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
      • getFieldData

        public java.lang.String getFieldData​(int index)
        Description copied from class: CompoundFileParser
        Returns the cell content of the current row. Multi-line cell entries are separated by a '\n' character.
        Specified by:
        getFieldData in class CompoundFileParser
        Parameters:
        index - refers to alpha-numerical columns only, as getFieldNames()
        Returns:
      • extractFieldName

        protected java.lang.String extractFieldName​(java.lang.String line)