Example #1
0
        /// <summary>  Compare a IChemObject with this IChemObject.
        ///
        /// </summary>
        /// <param name="object"> Object of type AtomType
        /// </param>
        /// <returns>         Return true, if the atomtypes are equal
        /// </returns>
        public virtual bool compare(System.Object object_Renamed)
        {
            if (!(object_Renamed is IChemObject))
            {
                return(false);
            }
            ChemObject chemObj = (ChemObject)object_Renamed;

            if ((System.Object)identifier == (System.Object)chemObj.identifier)
            {
                return(true);
            }
            return(false);
        }
Example #2
0
        /// <summary>  Clones this <code>IChemObject</code>. It clones the identifier, flags,
        /// properties and pointer vectors. The ChemObjectListeners are not cloned, and
        /// neither is the content of the pointer vectors.
        ///
        /// </summary>
        /// <returns>    The cloned object
        /// </returns>
        public virtual System.Object Clone()
        {
            ChemObject clone = (ChemObject)base.MemberwiseClone();

            // clone the flags
            clone.flags = new bool[CDKConstants.MAX_FLAG_INDEX + 1];
            for (int f = 0; f < flags.Length; f++)
            {
                clone.flags[f] = flags[f];
            }
            // clone the properties
            if (properties != null)
            {
                System.Collections.Hashtable   clonedHashtable = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable());
                System.Collections.IEnumerator keys            = properties.Keys.GetEnumerator();
                //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'"
                while (keys.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'"
                    System.Object key = keys.Current;
                    if (key is IChemObject)
                    {
                        key = ((IChemObject)key).Clone();
                    }
                    System.Object value_Renamed = properties[key];
                    if (value_Renamed is IChemObject)
                    {
                        value_Renamed = ((IChemObject)value_Renamed).Clone();
                    }
                    clonedHashtable[key] = value_Renamed;
                }
                clone.properties = clonedHashtable;
            }
            // delete all listeners
            clone.chemObjectListeners = null;
            return(clone);
        }