/** * @return Returns true if there are no set bits */ public boolean isEmpty() { return cardinality() == 0; }
/** * Rounds the bitset's cardinality to an integer or throws a * {@link RuntimeException} if the cardinality exceeds maximum int range. */ private int getCurrentCardinality() { long cardinality = BitSet.this.cardinality(); if (cardinality > Integer.MAX_VALUE) throw new RuntimeException("Bitset is larger than maximum positive integer: " + cardinality); return (int) cardinality; } };
/** * Rounds the bitset's cardinality to an integer or throws a * {@link RuntimeException} if the cardinality exceeds maximum int range. */ private int getCurrentCardinality() { long cardinality = BitSet.this.cardinality(); if (cardinality > Integer.MAX_VALUE) throw new RuntimeException("Bitset is larger than maximum positive integer: " + cardinality); return (int) cardinality; } };
/** * @return Returns true if there are no set bits */ public boolean isEmpty() { return cardinality() == 0; }
/** * Rounds the bitset's cardinality to an integer or throws a * {@link RuntimeException} if the cardinality exceeds maximum int range. */ private int getCurrentCardinality() { long cardinality = BitSet.this.cardinality(); if (cardinality > Integer.MAX_VALUE) throw new RuntimeException("Bitset is larger than maximum positive integer: " + cardinality); return (int) cardinality; } };
/** * Rounds the bitset's cardinality to an integer or throws a * {@link RuntimeException} if the cardinality exceeds maximum int range. */ private int getCurrentCardinality() { long cardinality = BitSet.this.cardinality(); if (cardinality > Integer.MAX_VALUE) throw new RuntimeException("Bitset is larger than maximum positive integer: " + cardinality); return (int) cardinality; } };
private double getDocumentCountPenalty(int labelIndex, int documentCount, BitSet [] labelsDocumentIndices) { return documentSizeCoefficients.getValue( labelsDocumentIndices[labelIndex].cardinality() / (double) documentCount); }
ClusterCandidate(int [] phraseIndices, BitSet documents, int cardinality, float score) { assert documents.cardinality() == cardinality; phrases = Lists.newArrayListWithCapacity(1); phrases.add(phraseIndices); this.documents = documents; this.score = score; this.cardinality = cardinality; } }
public boolean isArcPresent(int clusterA, int clusterB) { temp.clear(); int size; BitSet setA = clusterDocuments[clusterA]; BitSet setB = clusterDocuments[clusterB]; // Suitable for flat clustering // A small subgroup contained within a bigger group // will give small overlap ratio. Big ratios will // be produced only for balanced group sizes. if (setA.cardinality() < setB.cardinality()) { // addAll == or // reiatinAll == and | intersect temp.or(setA); temp.intersect(setB); size = (int) setB.cardinality(); } else { temp.or(setB); temp.intersect(setA); size = (int) setA.cardinality(); } return temp.cardinality() / (double) size >= clusterMergingThreshold; } }, true);
private int[] createCounts(BitSet bitsets[], BitSet neededCounts) { // TODO use the neededCounts bit set to avoid the creation of bit sets which are not needed // TODO Check the minimum frequency at this stage --> all BitSets with a lower cardinality can be set to null // and all following don't have to be created. BitSet[] combinations = new BitSet[(1 << bitsets.length)]; int pos, pos2; for (int i = 0; i < bitsets.length; ++i) { pos = (1 << i); combinations[pos] = bitsets[i]; pos2 = pos + 1; for (int j = 1; j < pos; ++j) { combinations[pos2] = ((BitSet) bitsets[i].clone()); combinations[pos2].intersect(combinations[j]); ++pos2; } } int cardinalities[] = new int[combinations.length]; for (int i = 1; i < combinations.length; ++i) { cardinalities[i] = (int) combinations[i].cardinality(); } return cardinalities; } }
/** * Collect documents from a bitset. */ private List<Document> collectDocuments(List<Document> l, BitSet bitset) { if (l == null) { l = Lists.newArrayListWithCapacity((int) bitset.cardinality()); } final BitSetIterator i = bitset.iterator(); for (int d = i.nextSetBit(); d >= 0; d = i.nextSetBit()) { l.add(documents.get(d)); } return l; }
cc.cardinality = (int) cc.documents.cardinality(); scratch.buffer = cc.phrases.get(0); scratch.elementsCount = scratch.buffer.length;
result.score += cc.score; result.cardinality = (int) result.documents.cardinality();
if (labelsDocumentIndices[i].cardinality() >= minClusterSize)
final int card = (int) me.cardinality(); if (card >= minCardinality)