Пример #1
0
 /// <summary> Method to create a specialized AtomTypeFactory. Available lists in CDK are:
 /// <ul>
 /// <li>org/openscience/cdk/config/data/jmol_atomtypes.txt
 /// <li>org/openscience/cdk/config/data/mol2_atomtypes.xml
 /// <li>org/openscience/cdk/config/data/structgen_atomtypes.xml
 /// <li>org/openscience/cdk/config/data/valency_atomtypes.xml
 /// <li>org/openscience/cdk/config/data/mm2_atomtypes.xml
 /// <li>org/openscience/cdk/config/data/mmff94_atomtypes.xml
 /// </ul>
 ///
 /// </summary>
 /// <param name="configFile">            String the name of the data file
 /// </param>
 /// <param name="builder">               IChemObjectBuilder used to make IChemObject instances
 /// </param>
 /// <returns>                        The AtomTypeFactory for the given data file
 /// </returns>
 /// <throws>  IOException            when the file cannot be read </throws>
 /// <throws>  ClassNotFoundException when the AtomTypeFactory cannot be found </throws>
 public static AtomTypeFactory getInstance(System.String configFile, IChemObjectBuilder builder)
 {
     if (tables == null)
     {
         tables = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable());
     }
     if (!(tables.ContainsKey(configFile)))
     {
         tables[configFile] = new AtomTypeFactory(configFile, builder);
     }
     return((AtomTypeFactory)tables[configFile]);
 }
Пример #2
0
		/// <param name="builder">the ChemObjectBuilder implementation used to construct the AtomType's.
		/// </param>
		protected internal virtual AtomTypeFactory getAtomTypeFactory(IChemObjectBuilder builder)
		{
			if (structgenATF == null)
			{
				try
				{
					structgenATF = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/structgen_atomtypes.xml", builder);
				}
				catch (System.Exception exception)
				{
					//logger.debug(exception);
					throw new CDKException("Could not instantiate AtomTypeFactory!", exception);
				}
			}
			return structgenATF;
		}
Пример #3
0
		/// <param name="builder">the ChemObjectBuilder implementation used to construct the AtomType's.
		/// </param>
		protected internal virtual AtomTypeFactory getAtomTypeFactory(IChemObjectBuilder builder)
		{
			if (structgenATF == null)
			{
				try
				{
					structgenATF = AtomTypeFactory.getInstance(atomTypeList, builder);
				}
				catch (System.Exception exception)
				{
					//logger.debug(exception);
					throw new CDKException("Could not instantiate AtomTypeFactory!", exception);
				}
			}
			return structgenATF;
		}
Пример #4
0
 /// <summary> 
 /// Takes an object which subclasses IChemObject, e.g. Molecule, and will
 /// read this (from file, database, internet etc). If the specific
 /// implementation does not support a specific IChemObject it will throw
 /// an Exception.
 /// 
 /// </summary>
 /// <param name="oObj"> The object that subclasses IChemObject
 /// </param>
 /// <returns>      The IChemObject read  
 /// </returns>
 /// <exception cref="CDKException"> 
 /// 
 /// </exception>
 public override IChemObject read(IChemObject oObj)
 {
     if (oObj is IChemFile)
     {
         if (pdbFactory == null)
         {
             try
             {
                 pdbFactory = AtomTypeFactory.getInstance("pdb_atomtypes.xml", ((IChemFile)oObj).Builder);
             }
             catch (System.Exception exception)
             {
                 //logger.debug(exception);
                 //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                 throw new CDKException("Could not setup list of PDB atom types! " + exception.Message);
             }
         }
         return readChemFile((IChemFile)oObj);
     }
     else
     {
         throw new CDKException("Only supported is reading of ChemFile objects.");
     }
 }
Пример #5
0
 /// <summary> 
 /// Contructs a new PDBReader that can read Molecules from a given
 /// Reader.
 /// 
 /// </summary>
 /// <param name="oIn"> The Reader to read from
 /// 
 /// </param>
 //UPGRADE_ISSUE: Class hierarchy differences between 'java.io.Reader' and 'System.IO.StreamReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
 public PDBReader(System.IO.StreamReader oIn)
 {
     //logger = new LoggingTool(this.GetType());
     //UPGRADE_TODO: The differences in the expected value  of parameters for constructor 'java.io.BufferedReader.BufferedReader'  may cause compilation errors.  "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1092'"
     _oInput = oIn;
     initIOSettings();
     pdbFactory = null;
 }
Пример #6
0
 /// <summary> Method to create a specialized AtomTypeFactory. Available lists in CDK are:
 /// <ul>
 /// <li>org/openscience/cdk/config/data/jmol_atomtypes.txt
 /// <li>org/openscience/cdk/config/data/mol2_atomtypes.xml
 /// <li>org/openscience/cdk/config/data/structgen_atomtypes.xml
 /// <li>org/openscience/cdk/config/data/valency_atomtypes.xml
 /// <li>org/openscience/cdk/config/data/mm2_atomtypes.xml
 /// <li>org/openscience/cdk/config/data/mmff94_atomtypes.xml
 /// </ul>
 /// 
 /// </summary>
 /// <param name="configFile">            String the name of the data file
 /// </param>
 /// <param name="builder">               IChemObjectBuilder used to make IChemObject instances
 /// </param>
 /// <returns>                        The AtomTypeFactory for the given data file
 /// </returns>
 /// <throws>  IOException            when the file cannot be read </throws>
 /// <throws>  ClassNotFoundException when the AtomTypeFactory cannot be found </throws>
 public static AtomTypeFactory getInstance(System.String configFile, IChemObjectBuilder builder)
 {
     if (tables == null)
     {
         tables = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable());
     }
     if (!(tables.ContainsKey(configFile)))
     {
         tables[configFile] = new AtomTypeFactory(configFile, builder);
     }
     return (AtomTypeFactory)tables[configFile];
 }