System.Xml.Schema.BitSet.And C# (CSharp) Method

And() public method

public And ( BitSet other ) : void
other BitSet
return void
        public void And(BitSet other) {
            /*
             * Need to synchronize  both this and other->
             * This might lead to deadlock if one thread grabs them in one order
             * while another thread grabs them the other order.
             * Use a trick from Doug Lea's book on concurrency,
             * somewhat complicated because BitSet overrides hashCode().
             */
            if (this == other) {
                return;
            }
            int bitsLength = bits.Length;
            int setLength = other.bits.Length;
            int n = (bitsLength > setLength) ? setLength : bitsLength;
            for (int i = n ; i-- > 0 ;) {
                bits[i] &= other.bits[i];
            }
            for (; n < bitsLength ; n++) {
                bits[n] = 0;
            }
        }

Usage Example

Esempio n. 1
0
 private BitSet GetApplicableMinMaxFollowPos(BitSet curpos, BitSet posWithRangeTerminals, BitSet[] minmaxFollowPos)
 {
     if (curpos.Intersects(posWithRangeTerminals))
     {
         BitSet set = new BitSet(this.positions.Count);
         set.Or(curpos);
         set.And(posWithRangeTerminals);
         curpos = curpos.Clone();
         for (int i = set.NextSet(-1); i != -1; i = set.NextSet(i))
         {
             LeafRangeNode particle = this.positions[i].particle as LeafRangeNode;
             curpos.Or(minmaxFollowPos[particle.Pos]);
         }
     }
     return(curpos);
 }
All Usage Examples Of System.Xml.Schema.BitSet::And