Class MRecord


  • @PublicAPI
    public class MRecord
    extends Object
    Record in a multi-molecule file.
    Since:
    Marvin 5.0, 04/06/2006
    • Field Detail

      • F_MOL_MISSING

        public static final int F_MOL_MISSING
        Molecule (or reaction) is missing from the record. This record descriptor flag is set if the molecule part of the record contains only a registry number ("MIREG", "MEREG", "RIREG" or "REREG") in case of an RDfile.
        Since:
        Marvin 5.0.3, 03/20/2008
        See Also:
        getFlags(), Constant Field Values
      • fileStartPosition

        protected long fileStartPosition
      • fileEndPosition

        protected long fileEndPosition
    • Constructor Detail

      • MRecord

        public MRecord()
        Default constructor.
        Since:
        Marvin 5.2
      • MRecord

        public MRecord​(long start,
                       long end,
                       int lineno,
                       String s,
                       MPropertyContainer p,
                       int[] lmap)
        Creates a record.
        Parameters:
        start - the start position in input file
        end - the end position in input file
        lineno - the line number at the starting point
        s - the record string
        p - the properties
        lmap - original line numbers
      • MRecord

        public MRecord​(long start,
                       long end,
                       int lineno,
                       String s,
                       MPropertyContainer p,
                       int[] lmap,
                       int descflags)
        Creates a record.
        Parameters:
        start - the start position in input file
        end - the end position in input file
        lineno - the line number at the starting point
        s - the record string
        p - the properties
        lmap - original line numbers
        descflags - extra record descriptor flags
      • MRecord

        public MRecord​(long start,
                       long end,
                       int lineno,
                       String s,
                       MPropertyContainer p,
                       int[] lmap,
                       int descflags,
                       String moleculeName)
        Creates a record.
        Parameters:
        start - the start position in input file
        end - the end position in input file
        lineno - the line number at the starting point
        s - the record string
        p - the properties
        lmap - original line numbers
        descflags - extra record descriptor flags
        moleculeName - name of the molecule
        Since:
        Marvin 5.0.3, 03/20/2008
    • Method Detail

      • getEncoding

        public String getEncoding()
        Gets the encoding.
        Returns:
        the encoding
        Since:
        Marvin 5.3
      • getMolString

        public String getMolString()
        Gets the molecule string, with preprended header and appended footer if appropriate. This string can be imported to get a valid molecule.
        Returns:
        the molecule string
        Since:
        Marvin 5.3
      • setMolBytes

        public void setMolBytes​(byte[] molBytes)
        Sets the molecule bytes. Used for binary formats, otherwise setMolString(java.lang.String) is called to set the mol string.
        Parameters:
        molBytes - the molecule bytes
      • getMolBytes

        public byte[] getMolBytes()
        Gets the molecule bytes, with preprended header and appended footer if appropriate. This byte array can be imported to get a valid molecule. Only used for binary formats, otherwise call getMolString().
        Returns:
        the molecule string
        Since:
        Marvin 5.4
      • getHeaderNewLineCount

        public int getHeaderNewLineCount()
        Gets the number of new lines in the molecule header part.
        Returns:
        the number of new lines in the molecule header part
        Since:
        Marvin 5.3
      • getFormat

        public String getFormat()
        Gets the full format string of the record. E.g. for a gzipped mrv it returns "gzip:mrv".
        Returns:
        the format of the record as a string.
      • getInputFormat

        public String getInputFormat()
        Gets the input format. This the format of the file. E.g for a gzipped mrv it returns "mrv"
        Returns:
        the input format
        Since:
        Marvin 5.3
      • getPropertyContainer

        public MPropertyContainer getPropertyContainer()
        Gets the properties.
        Returns:
        the properties
      • getLineNumberMap

        public int[] getLineNumberMap()
        Gets the line number to original line number mapping.
        Returns:
        the mapping
      • getStartPosition

        public long getStartPosition()
        Gets the start position in the input file.
        Returns:
        the position
      • getEndPosition

        public long getEndPosition()
        Gets the end position in the input file.
        Returns:
        the position
      • getStartLineCount

        public int getStartLineCount()
        Gets the line number at the starting point.
        Returns:
        the line number
      • getEndLineCount

        public int getEndLineCount()
        Gets the line number at the ending point.
        Returns:
        the line number
        Since:
        Marvin 5.3
      • getFlags

        public int getFlags()
        Gets the record descriptor flags.
        Returns:
        the record descriptor flags
        Since:
        Marvin 5.0.3, 03/20/2008
        See Also:
        F_MOL_MISSING
      • getMoleculeName

        public String getMoleculeName()
        Returns the name of the molecule in the record.
        Returns:
        the name or an empty string if it's not specified
        Since:
        Marvin 6.3