Beispiel #1
0
        /// <summary>
        /// Build and return a signature block representing this element block.
        /// </summary>
        /// <remarks>
        /// This is primarily intended for use on blocks of element lines to reduce
        /// them to blocks of element signatures and thereby increase performance
        /// when comparing blocks of lines from a text file for instance.
        /// </remarks>
        /// <returns></returns>
        public Block Signature()
        {
            long  nLength = this.Length;
            Block oBlock  = new Block(nLength);

            for (long nIndex = 0; nIndex < nLength; nIndex++)
            {
                Signature        oSignature        = maElements[nIndex].Signature();
                ElementSignature oElementSignature = new ElementSignature(oSignature);
                oBlock.Elements[nIndex] = oElementSignature;
            }
            return(oBlock);
        }
Beispiel #2
0
        /// <summary>
        /// Check if both elements are equal.
        /// </summary>
        /// <param name="poElement1">Left hand side operand element to compare.</param>
        /// <param name="poElement2">Right hand side operand element to compare.</param>
        /// <returns>True if equal, false otherwise.</returns>
        private static bool AreEqual(ElementSignature poElement1, ElementSignature poElement2)
        {
            Signature oSignature1 = (Signature)poElement1.Contents;
            Signature oSignature2 = (Signature)poElement2.Contents;
            bool      bEqual      = false;

            if (oSignature1.Length == oSignature2.Length)
            {
                if (oSignature1.Area == oSignature2.Area)
                {
                    if (oSignature1.CentreOfMass == oSignature2.CentreOfMass)
                    {
                        bEqual = true;
                    }
                }
            }
            return(bEqual);
        }