Example #1
0
        /// <summary>
        /// Checks whether all the positive bits in BitArray bs2 occur in BitArray bs1. If
        /// so, the molecular structure from which bs2 was generated is a possible
        /// substructure of bs1.
        /// </summary>
        /// <example>
        /// <include file='IncludeExamples.xml' path='Comments/Codes[@id="NCDK.Fingerprints.FingerprinterTool_Example.cs+IsSubset"]/*' />
        /// </example>
        /// <param name="bs1">The reference <see cref="BitArray"/></param>
        /// <param name="bs2">The <see cref="BitArray"/> which is compared with bs1</param>
        /// <returns>True, if bs2 is a subset of bs1</returns>
        // @cdk.keyword    substructure search
        public static bool IsSubset(BitArray bs1, BitArray bs2)
        {
            BitArray clone = (BitArray)bs1.Clone();

            BitArrays.And(clone, bs2);
            if (BitArrays.Equals(clone, bs2))
            {
                return(true);
            }
            return(false);
        }