示例#1
0
        /// <summary>
        /// true if this mask is a subset of <paramref name="o"/>
        /// </summary>
        public bool IsSubMaskOf(ExecutionMask o)
        {
            if (this.GetType() != o.GetType())
            {
                throw new ArgumentException("unable to compare two masks of different type: " + this.GetType().FullName + ", " + this.GetType().FullName + ";");
            }
            if (!object.ReferenceEquals(this.GridData, o.GridData))
            {
                throw new ArgumentException("masks live on different grids.");
            }

            if (this.NoOfItemsLocally > o.NoOfItemsLocally)
            {
                return(false);
            }

            BitArray omask = o.GetBitMask();

            foreach (var c in this)
            {
                for (int i = 0; i < c.Len; i++)
                {
                    int j = i + c.i0;
                    if (!omask[j])
                    {
                        return(false);
                    }
                }
            }

            // all tests passed positive
            return(true);
        }
示例#2
0
        /// <summary>
        /// Compares two masks according to the masked
        /// elements
        /// </summary>
        /// <param name="obj">The object to compare this object to</param>
        /// <returns>
        /// True, if the given object represents a mask of the same type (cell/edge)
        /// containing exactly the same cells/edges as this object.
        /// </returns>
        public override bool Equals(object obj)
        {
            ExecutionMask o = obj as ExecutionMask;

            if (o == null)
            {
                return(false);
            }

            if (o.GetType() != this.GetType())
            {
                return(false);
            }

            if (o.m_IMax != this.m_IMax)
            {
                return(false);
            }

            return(Enumerable.SequenceEqual(o.Sequence, this.Sequence));
        }
示例#3
0
 /// <summary>
 /// Creates a new enumerator
 /// </summary>
 /// <param name="__owner">The creator of this enumerator</param>
 public ChunkEnumerator(ExecutionMask __owner)
 {
     owner    = __owner;
     curr.i0  = -1;
     curr.Len = -1;
 }