Beispiel #1
0
        /// <summary>
        /// Performs an XOR on mri's MT and Specs to give a unique key into the contents.
        /// </summary>
        /// <param name="mtGuid">Guid of the MaterialType</param>
        /// <param name="specGuids">Guids for the list of MaterialSpecifications</param>
        /// <returns>Guid defining the unqueness of the Guids</returns>
        public static Guid ContentsXOR(Guid mtGuid, ICollection specGuids)
        {
            Guid returnGuid = mtGuid;

            // ReSharper disable once LoopCanBeConvertedToQuery
            foreach (Guid specGuid in specGuids)
            {
                returnGuid = GuidOps.XOR(returnGuid, specGuid);
            }

            return(returnGuid);
        }
Beispiel #2
0
 /// <summary>
 /// Function to check if a guid is contained in this MRI. See 'g' below for possiblitites
 /// </summary>
 /// <param name="g">Can be a MRI guid, material type guid, a material specification,
 /// or an XOR of material type and specification guids</param>
 /// <returns>True if found</returns>
 public bool ContainsGuid(Guid g)
 {
     if (m_guid == g || MaterialType.Guid == g)
     {
         return(true);
     }
     else
     {
         // ReSharper disable once LoopCanBeConvertedToQuery
         foreach (Guid specGuid in MaterialSpecificationGuids)
         {
             if (specGuid != MaterialType.Guid &&
                 (specGuid == g || GuidOps.XOR(MaterialType.Guid, specGuid) == g))
             {
                 return(true);
             }
         } // end foreach specGuid
     }     // end !mri.Guid == g
     return(false);
 }         // end ContainsGuid