Here you can find the source of ensureExclusivity(BitSet bs1, BitSet bs2)
Parameter | Description |
---|---|
bs1 | the first bitset |
bs2 | the second bitset |
public static void ensureExclusivity(BitSet bs1, BitSet bs2)
//package com.java2s; /*// www . jav a2s . c o m * NMerge is Copyright 2009 Desmond Schmidt * * This file is part of NMerge. NMerge is a Java library for merging * multiple versions into multi-version documents (MVDs), and for * reading, searching and comparing them. * * NMerge is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * NMerge is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.util.BitSet; public class Main { /** * Adjust two bitsets so that they do not overlap * @param bs1 the first bitset * @param bs2 the second bitset */ public static void ensureExclusivity(BitSet bs1, BitSet bs2) { if (bs1.cardinality() > bs2.cardinality()) { bs1.andNot(bs2); bs2.andNot(bs1); } else { bs2.andNot(bs1); bs1.andNot(bs2); } } }