Пример #1
0
        /**
         * Return true if the given object is equal to this one.
         */
        public override bool Equals(Object obj)
        {
            // Don't bother if we aren't the same type of object
            if (!(obj is PolyDefault))
            {
                return(false);
            }

            // Cast it to this object
            PolyDefault that = (PolyDefault)obj;

            // We need to have the same hole type
            if (this.isHole != that.isHole)
            {
                return(false);
            }

            // Go through the elements to match
            if (m_List.Count != that.m_List.Count)
            {
                return(false);
            }

            // Loop through and make sure each item is equal
            for (int i = 0; i < m_List.Count; i++)
            {
                IPoly p1 = (IPoly)m_List[i];
                IPoly p2 = (IPoly)that.m_List[i];

                if (!p1.Equals(p2))
                {
                    return(false);
                }
            }

            // We have a match
            return(true);
        }