Ejemplo n.º 1
0
        /// <summary> Returns all the AtomContainer's of a ChemFile.</summary>
        public static IAtomContainer[] getAllAtomContainers(IChemFile file)
        {
            IChemSequence[] sequences = file.ChemSequences;
            int             acCount   = 0;

            System.Collections.ArrayList acArrays = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
            for (int i = 0; i < sequences.Length; i++)
            {
                IAtomContainer[] sequenceContainers = ChemSequenceManipulator.getAllAtomContainers(sequences[i]);
                acArrays.Add(sequenceContainers);
                acCount += sequenceContainers.Length;
            }
            IAtomContainer[] containers = new IAtomContainer[acCount];
            int arrayOffset             = 0;

            //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'"
            for (System.Collections.IEnumerator acArraysElements = acArrays.GetEnumerator(); acArraysElements.MoveNext();)
            {
                //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'"
                IAtomContainer[] modelContainers = (IAtomContainer[])acArraysElements.Current;
                Array.Copy(modelContainers, 0, containers, arrayOffset, modelContainers.Length);
                arrayOffset += modelContainers.Length;
            }
            return(containers);
        }
Ejemplo n.º 2
0
 /// <summary> Returns a List of all IChemObject in this ChemFile.
 ///
 /// </summary>
 /// <returns>  A list of all ChemObjects
 /// </returns>
 public static System.Collections.IList getAllChemObjects(IChemFile file)
 {
     System.Collections.ArrayList list = new System.Collections.ArrayList();
     list.Add(file);
     for (int i = 0; i < file.ChemSequenceCount; i++)
     {
         list.AddRange(ChemSequenceManipulator.getAllChemObjects(file.getChemSequence(i)));
     }
     return(list);
 }
Ejemplo n.º 3
0
        public static int getBondCount(IChemFile file)
        {
            int count = 0;

            for (int i = 0; i < file.ChemSequenceCount; i++)
            {
                count += ChemSequenceManipulator.getBondCount(file.getChemSequence(i));
            }
            return(count);
        }
Ejemplo n.º 4
0
        /// <summary> Puts all the Molecules of this container together in one
        /// AtomCcntainer.
        ///
        /// </summary>
        /// <returns>  The AtomContainer with all the Molecules of this container
        ///
        /// </returns>
        /// <deprecated> This method has a serious performace impact. Try to use
        /// other methods.
        /// </deprecated>
        public static IAtomContainer getAllInOneContainer(IChemFile file)
        {
            IAtomContainer container = file.Builder.newAtomContainer();

            for (int i = 0; i < file.ChemSequenceCount; i++)
            {
                IChemSequence sequence = file.getChemSequence(i);
                container.add(ChemSequenceManipulator.getAllInOneContainer(sequence));
            }
            return(container);
        }