Java Code Examples for org.apache.lucene.util.OpenBitSet#get()
The following examples show how to use
org.apache.lucene.util.OpenBitSet#get() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FilterIndexReaderByStringId.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public boolean next() throws IOException { try { if (!in.next()) { return false; } OpenBitSet deletedDocuments = getDeletedDocuments(); while (deletedDocuments.get(in.doc())) { if (!in.next()) { return false; } } // Not masked return true; } catch(IOException ioe) { s_logger.error("Error reading docs for "+id); throw ioe; } }
Example 2
Source File: FilterIndexReaderByStringId.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public boolean skipTo(int i) throws IOException { if (!in.skipTo(i)) { return false; } OpenBitSet deletedDocuments = getDeletedDocuments(); while (deletedDocuments.get(in.doc())) { if (!in.next()) { return false; } } return true; }
Example 3
Source File: Validator.java From winter with Apache License 2.0 | 6 votes |
private OpenBitSet extendWith(OpenBitSet lhs, int rhs, int extensionAttr) { if (lhs.get(extensionAttr) || // Triviality: AA->C cannot be valid, because A->C is invalid (rhs == extensionAttr) || // Triviality: AC->C cannot be valid, because A->C is invalid this.posCover.containsFdOrGeneralization(lhs, extensionAttr) || // Pruning: If A->B, then AB->C cannot be minimal // TODO: this pruning is not used in the Inductor when inverting the negCover; so either it is useless here or it is useful in the Inductor? ((this.posCover.getChildren() != null) && (this.posCover.getChildren()[extensionAttr] != null) && this.posCover.getChildren()[extensionAttr].isFd(rhs))) // Pruning: If B->C, then AB->C cannot be minimal return null; OpenBitSet childLhs = lhs.clone(); // TODO: This clone() could be avoided when done externally childLhs.set(extensionAttr); // TODO: Add more pruning here // if contains FD: element was a child before and has already been added to the next level // if contains Generalization: element cannot be minimal, because generalizations have already been validated if (this.posCover.containsFdOrGeneralization(childLhs, rhs)) // Pruning: If A->C, then AB->C cannot be minimal return null; return childLhs; }
Example 4
Source File: HyFD.java From winter with Apache License 2.0 | 6 votes |
protected int specializePositiveCover(FDTree posCoverTree, OpenBitSet lhs, int rhs) { int newFDs = 0; List<OpenBitSet> specLhss = posCoverTree.getFdAndGeneralizations(lhs, rhs); for (OpenBitSet specLhs : specLhss) { posCoverTree.removeFunctionalDependency(specLhs, rhs); if (specLhs.cardinality() == posCoverTree.getMaxDepth()) continue; for (int attr = this.numAttributes - 1; attr >= 0; attr--) { // TODO: Is iterating backwards a good or bad idea? if (!lhs.get(attr) && (attr != rhs)) { specLhs.set(attr); if (!posCoverTree.containsFdOrGeneralization(specLhs, rhs)) { posCoverTree.addFunctionalDependency(specLhs, rhs); newFDs++; } specLhs.clear(attr); } } } return newFDs; }
Example 5
Source File: FilterIndexReaderByStringId.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public int read(int[] docs, int[] freqs) throws IOException { int[] innerDocs = new int[docs.length]; int[] innerFreq = new int[docs.length]; int count = in.read(innerDocs, innerFreq); // Is the stream exhausted if (count == 0) { return 0; } OpenBitSet deletedDocuments = getDeletedDocuments(); while (allDeleted(innerDocs, count, deletedDocuments)) { count = in.read(innerDocs, innerFreq); // Is the stream exhausted if (count == 0) { return 0; } } // Add non deleted int insertPosition = 0; for (int i = 0; i < count; i++) { if (!deletedDocuments.get(innerDocs[i])) { docs[insertPosition] = innerDocs[i]; freqs[insertPosition] = innerFreq[i]; insertPosition++; } } return insertPosition; }
Example 6
Source File: FilterIndexReaderByStringId.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
private boolean allDeleted(int[] docs, int fillSize, OpenBitSet deletedDocuments) { for (int i = 0; i < fillSize; i++) { if (!deletedDocuments.get(docs[i])) { return false; } } return true; }
Example 7
Source File: FDEP.java From winter with Apache License 2.0 | 5 votes |
protected void specializePositiveCover(FDTree posCoverTree, OpenBitSet lhs, int rhs) { List<OpenBitSet> specLhss = null; specLhss = posCoverTree.getFdAndGeneralizations(lhs, rhs); for (OpenBitSet specLhs : specLhss) { posCoverTree.removeFunctionalDependency(specLhs, rhs); for (int attr = this.numAttributes - 1; attr >= 0; attr--) { if (!lhs.get(attr) && (attr != rhs)) { specLhs.set(attr); if (!posCoverTree.containsFdOrGeneralization(specLhs, rhs)) posCoverTree.addFunctionalDependency(specLhs, rhs); specLhs.clear(attr); } } } }
Example 8
Source File: Inductor.java From winter with Apache License 2.0 | 5 votes |
protected int specializePositiveCover(OpenBitSet lhs, int rhs, FDList nonFds) { int numAttributes = this.posCover.getChildren().length; int newFDs = 0; List<OpenBitSet> specLhss; if (!(specLhss = this.posCover.getFdAndGeneralizations(lhs, rhs)).isEmpty()) { // TODO: May be "while" instead of "if"? for (OpenBitSet specLhs : specLhss) { this.posCover.removeFunctionalDependency(specLhs, rhs); if ((this.posCover.getMaxDepth() > 0) && (specLhs.cardinality() >= this.posCover.getMaxDepth())) continue; for (int attr = numAttributes - 1; attr >= 0; attr--) { // TODO: Is iterating backwards a good or bad idea? if (!lhs.get(attr) && (attr != rhs)) { specLhs.set(attr); if (!this.posCover.containsFdOrGeneralization(specLhs, rhs)) { this.posCover.addFunctionalDependency(specLhs, rhs); newFDs++; // If dynamic memory management is enabled, frequently check the memory consumption and trim the positive cover if it does not fit anymore this.memoryGuardian.memoryChanged(1); this.memoryGuardian.match(this.negCover, this.posCover, nonFds); } specLhs.clear(attr); } } } } return newFDs; }
Example 9
Source File: FDTreeElement.java From winter with Apache License 2.0 | 5 votes |
public void grow(OpenBitSet lhs, FDTree fdTree) { // Add specializations of all nodes an mark them as isFD, but if specialization exists, then it is invalid and should not be marked; only add specializations of nodes not marked as isFD! OpenBitSet rhs = this.rhsAttributes; OpenBitSet invalidRhs = rhs.clone(); invalidRhs.remove(this.rhsFds); // Add specializations that are not invalid if (invalidRhs.cardinality() > 0) { for (int extensionAttr = 0; extensionAttr < this.numAttributes; extensionAttr++) { if (lhs.get(extensionAttr) || rhs.get(extensionAttr)) continue; lhs.set(extensionAttr); fdTree.addFunctionalDependencyIfNotInvalid(lhs, invalidRhs); lhs.clear(extensionAttr); } } // Traverse children and let them add their specializations if (this.children != null) { for (int childAttr = 0; childAttr < this.numAttributes; childAttr++) { FDTreeElement element = this.children[childAttr]; if (element != null) { lhs.set(childAttr); element.grow(lhs, fdTree); lhs.clear(childAttr); } } } }