Class AbstractParser

  • Direct Known Subclasses:
    Mol2FileParser

    public abstract class AbstractParser
    extends java.lang.Object
    A parser is used to load and save molecules from the filesystem. The save procedure is optional
    Author:
    freyssj
    • Field Detail

      • NEWLINE

        protected static final java.lang.String NEWLINE
      • errors

        protected java.util.List<java.lang.String> errors
      • optimize3D

        protected boolean optimize3D
    • Constructor Detail

      • AbstractParser

        public AbstractParser()
    • Method Detail

      • loadGroup

        public final java.util.List<Molecule3D> loadGroup​(java.lang.String fileName)
                                                   throws java.lang.Exception
        Parameters:
        fileName -
        Throws:
        java.lang.Exception
      • loadGroup

        public java.util.List<Molecule3D> loadGroup​(java.lang.String fileName,
                                                    java.io.Reader in)
                                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • loadGroup

        public abstract java.util.List<Molecule3D> loadGroup​(java.lang.String fileName,
                                                             java.io.Reader in,
                                                             int from,
                                                             int to)
                                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • load

        public final Molecule3D load​(java.io.File file)
                              throws java.lang.Exception
        Parameters:
        file -
        Throws:
        java.lang.Exception
      • load

        public final Molecule3D load​(java.lang.String fileName)
                              throws java.lang.Exception
        Parameters:
        fileName -
        Throws:
        java.lang.Exception
      • load

        public final Molecule3D load​(java.lang.String fileName,
                                     java.io.Reader in)
                              throws java.lang.Exception
        Parameters:
        fileName -
        in -
        Throws:
        java.lang.Exception
      • save

        public final void save​(java.util.List<Molecule3D> mol,
                               java.lang.String fileName)
                        throws java.lang.Exception
        Parameters:
        mol -
        fileName -
        Throws:
        java.lang.Exception
      • save

        public final void save​(Molecule3D mol,
                               java.lang.String fileName)
                        throws java.lang.Exception
        Parameters:
        mol -
        fileName -
        Throws:
        java.lang.Exception
      • save

        public void save​(Molecule3D mol,
                         java.io.Writer writer)
                  throws java.lang.Exception
        Parameters:
        mol -
        writer -
        Throws:
        java.lang.Exception
      • save

        public void save​(java.util.List<Molecule3D> mols,
                         java.io.Writer writer)
                  throws java.lang.Exception
        If not subclassed, save the files separately
        Parameters:
        mols -
        writer -
        Throws:
        java.lang.Exception
      • convertDataToPrimitiveTypes

        public static final void convertDataToPrimitiveTypes​(java.util.List<Molecule3D> res)
      • writeR

        protected static void writeR​(java.io.Writer writer,
                                     java.lang.String data,
                                     int len)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • writeL

        protected static void writeL​(java.io.Writer writer,
                                     java.lang.String data,
                                     int len)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • getErrors

        public java.util.List<java.lang.String> getErrors()
      • is3D

        protected static boolean is3D​(Molecule3D m)
      • setOptimize3D

        public void setOptimize3D​(boolean optimize3d)
      • isOptimize3D

        public boolean isOptimize3D()