예제 #1
0
        /**
         * Performs an intersection check.
         * @param m1 the first APMonom
         * @param m2 the second APMonom
         * @return <b>true</b> if the intersection of <i>m1</i> and <i>m2</i> is empty.
         */
        public static bool isIntersectionEmpty(APMonom m1, APMonom m2)
        {
            // check if there are contradicting values
            int set_in_both = m1.getSetBits().bitset & m2.getSetBits().bitset;

            if ((m1.getValueBits().bitset & set_in_both) != (m2.getValueBits().bitset & set_in_both))
            {
                // contradiction
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        /**
         * Increment the iterator (used by the boost iterator base class).
         */
        public void increment()
        {
            //BitSet set_mask = new BitSet(_m.getSetBits());
            BitSet set_mask = _m.getSetBits().getBitSetObject();
            int    i        = set_mask.nextClearBit(0);

            while (i < _ap_set.size())
            {
                if (_cur_e.get(i) == false)
                {
                    _cur_e.set(i, true);
                    return;
                }
                else
                {
                    _cur_e.set(i, false);
                    i = set_mask.nextClearBit(i + 1);
                }
            }

            // overflow -> end
            _end_marker = true;
        }
예제 #3
0
파일: APMonom.cs 프로젝트: nhannhan159/PAT
        /**
           * Performs an intersection check.
           * @param m1 the first APMonom
           * @param m2 the second APMonom
           * @return <b>true</b> if the intersection of <i>m1</i> and <i>m2</i> is empty.
           */
        public static bool isIntersectionEmpty(APMonom m1, APMonom m2)
        {
            // check if there are contradicting values
            int set_in_both = m1.getSetBits().bitset & m2.getSetBits().bitset;

            if ((m1.getValueBits().bitset & set_in_both) != (m2.getValueBits().bitset & set_in_both))
            {
                // contradiction
                return true;
            }
            else
            {
                return false;
            }
        }