本文整理汇总了Java中org.apache.lucene.util.OpenBitSet类的典型用法代码示例。如果您正苦于以下问题:Java OpenBitSet类的具体用法?Java OpenBitSet怎么用?Java OpenBitSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OpenBitSet类属于org.apache.lucene.util包,在下文中一共展示了OpenBitSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildPrefixBlocks
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
/**
* Build the prefix blocks for a level. It is a Hashmap containing the
* prefix as a key and the corresponding attributes as the value.
*/
private void buildPrefixBlocks() {
// System.out.println("Start BuildPrefixBlocks");
this.prefix_blocks.clear();
for (OpenBitSet level_iter : level0.keySet()) {
OpenBitSet prefix = getPrefix(level_iter);
if (prefix_blocks.containsKey(prefix)) {
prefix_blocks.get(prefix).add(level_iter);
} else {
ObjectArrayList<OpenBitSet> list = new ObjectArrayList<OpenBitSet>();
list.add(level_iter);
prefix_blocks.put(prefix, list);
}
}
// System.out.println("Stop BuildPrefixBlocks");
}
示例2: addGeneralization
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
public FDTreeElement addGeneralization(OpenBitSet lhs, OpenBitSet rhs) {
FDTreeElement currentNode = this;
currentNode.addRhsAttributes(rhs);
boolean newElement = false;
for (int i = lhs.nextSetBit(0); i >= 0; i = lhs.nextSetBit(i + 1)) {
if (currentNode.getChildren() == null) {
currentNode.setChildren(new FDTreeElement[this.numAttributes]);
currentNode.getChildren()[i] = new FDTreeElement(this.numAttributes);
newElement = true;
}
else if (currentNode.getChildren()[i] == null) {
currentNode.getChildren()[i] = new FDTreeElement(this.numAttributes);
newElement = true;
}
currentNode = currentNode.getChildren()[i];
currentNode.addRhsAttributes(rhs);
}
if (newElement)
return currentNode;
return null;
}
示例3: getUCCAndGeneralizations
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
protected void getUCCAndGeneralizations(OpenBitSet ucc, int currentUCCAttr, OpenBitSet currentUCC, List<OpenBitSet> foundUCCs) {
if (this.isUCC)
foundUCCs.add(currentUCC.clone());
if (this.children == null)
return;
while (currentUCCAttr >= 0) {
int nextLhsAttr = ucc.nextSetBit(currentUCCAttr + 1);
if (this.children[currentUCCAttr] != null) {
currentUCC.set(currentUCCAttr);
this.children[currentUCCAttr].getUCCAndGeneralizations(ucc, nextLhsAttr, currentUCC, foundUCCs);
currentUCC.clear(currentUCCAttr);
}
currentUCCAttr = nextLhsAttr;
}
}
示例4: filterSpecializations
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
public void filterSpecializations(FDTree filteredTree, OpenBitSet activePath) {
int attr;
for (attr = 1; attr <= maxAttributeNumber; attr++) {
if (children[attr - 1] != null) {
activePath.set(attr);
children[attr - 1].filterSpecializations(filteredTree, activePath);
activePath.clear(attr);
}
}
for (attr = 1; attr <= maxAttributeNumber; attr++) {
if (this.isfd[attr - 1]) {
// TODO: containsSpecialization should be enough
if (!filteredTree.getSpecialization(activePath, attr, 0, new OpenBitSet())) {
filteredTree.addFunctionalDependency(activePath, attr);
}
}
}
}
示例5: removeLhs
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
public void removeLhs(OpenBitSet lhs) {
LhsTrieElement[] path = new LhsTrieElement[(int)lhs.cardinality()];
int currentPathIndex = 0;
LhsTrieElement currentNode = this;
path[currentPathIndex] = currentNode;
currentPathIndex++;
for (int i = lhs.nextSetBit(0); i >= 0; i = lhs.nextSetBit(i + 1)) {
currentNode = currentNode.getChildren()[i];
path[currentPathIndex] = currentNode;
currentPathIndex++;
}
for (int i = path.length - 1; i >= 0; i --) {
path[i].removeChild(i);
if (path[i].getChildren() != null)
break;
}
}
示例6: testGetGeneralizationAndDelete
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
@Test
public void testGetGeneralizationAndDelete() {
OpenBitSet lhs = new OpenBitSet();
lhs.set(1);
lhs.set(2);
lhs.set(4);
lhs.set(5);
OpenBitSet specLhs = new OpenBitSet();
assertTrue(fdtree.getGeneralizationAndDelete(lhs, 3, 0, specLhs));
OpenBitSet expResult = new OpenBitSet();
expResult.set(1);
expResult.set(2);
expResult.set(4);
assertEquals(expResult, specLhs);
}
示例7: testDeleteGeneralizations
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
@Test
public void testDeleteGeneralizations() {
fdtree = new FDTree(4);
OpenBitSet lhs = new OpenBitSet();
lhs.set(1);
lhs.set(2);
fdtree.addFunctionalDependency(lhs, 4);
lhs.clear(2);
lhs.set(3);
fdtree.addFunctionalDependency(lhs, 4);
lhs.set(2);
fdtree.deleteGeneralizations(lhs, 4, 0);
assertTrue(fdtree.isEmpty());
}
示例8: searchRequestToBitSet
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
private OpenBitSet searchRequestToBitSet(@Nullable final Search searchreq, IndexSearcher searcher,
IndexReader reader) throws IOException
{
if( searchreq != null )
{
Filter filters = getFilter(searchreq);
Query query = getQuery(searchreq, null, false);
BitSetCollector collector = new BitSetCollector();
searcher.search(query, filters, collector);
return collector.getBitSet();
}
else
{
return (OpenBitSet) new InstitutionFilter().getDocIdSet(reader);
}
}
示例9: add
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
public boolean add(int[][] compressedRecords, OpenBitSet lhs, int nextLhsAttr, int recordId, int content) {
if (nextLhsAttr < 0)
return this.content != -1 && this.content == content;
int nextCluster = compressedRecords[recordId][nextLhsAttr];
if (nextCluster < 0)
return true;
ClusterTreeElement child = this.children.get(nextCluster);
if (child == null) {
child = new ClusterTreeElement(compressedRecords, lhs, lhs.nextSetBit(nextLhsAttr + 1), recordId, content);
this.children.put(nextCluster, child);
return true;
}
return child.add(compressedRecords, lhs, lhs.nextSetBit(nextLhsAttr + 1), recordId, content);
}
示例10: getFdAndGeneralizations
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
protected void getFdAndGeneralizations(OpenBitSet lhs, int rhs, int currentLhsAttr, OpenBitSet currentLhs, List<OpenBitSet> foundLhs) {
if (this.isFd(rhs))
foundLhs.add(currentLhs.clone());
if (this.children == null)
return;
while (currentLhsAttr >= 0) {
int nextLhsAttr = lhs.nextSetBit(currentLhsAttr + 1);
if ((this.children[currentLhsAttr] != null) && (this.children[currentLhsAttr].hasRhsAttribute(rhs))) {
currentLhs.set(currentLhsAttr);
this.children[currentLhsAttr].getFdAndGeneralizations(lhs, rhs, nextLhsAttr, currentLhs, foundLhs);
currentLhs.clear(currentLhsAttr);
}
currentLhsAttr = nextLhsAttr;
}
}
示例11: filterGeneralizations
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
protected void filterGeneralizations(OpenBitSet lhs, int rhs, int currentLhsAttr, OpenBitSet currentLhs) {
if (currentLhs.equals(lhs))
return;
this.rhsFds.clear(rhs);
// Is the dependency already read and we have not yet found a generalization?
if (currentLhsAttr < 0)
return;
if (this.children != null) {
for (int nextLhsAttr = lhs.nextSetBit(currentLhsAttr); nextLhsAttr >= 0; nextLhsAttr = lhs.nextSetBit(nextLhsAttr + 1)) {
if ((this.children[nextLhsAttr] != null) && (this.children[nextLhsAttr].hasRhsAttribute(rhs))) {
currentLhs.set(nextLhsAttr);
this.children[nextLhsAttr].filterGeneralizations(lhs, rhs, lhs.nextSetBit(nextLhsAttr + 1), currentLhs);
currentLhs.clear(nextLhsAttr);
}
}
}
}
示例12: checkSubsets
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
/**
* Checks whether all subsets of X (with length of X - 1) are part of the last level.
* Only if this check return true X is added to the new level.
*
* @param X
* @return
*/
private boolean checkSubsets(OpenBitSet X) {
boolean xIsValid = true;
// clone of X for usage in the following loop
OpenBitSet Xclone = (OpenBitSet) X.clone();
for (int l = X.nextSetBit(0); l >= 0; l = X.nextSetBit(l + 1)) {
Xclone.clear(l);
if (!level0.containsKey(Xclone)) {
xIsValid = false;
break;
}
Xclone.set(l);
}
return xIsValid;
}
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:25,代码来源:TaneAlgorithmFilterTreeDirect.java
示例13: addFunctionalDependency
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
public FDTreeElement addFunctionalDependency(OpenBitSet lhs, OpenBitSet rhs) {
FDTreeElement currentNode = this;
currentNode.addRhsAttributes(rhs);
int lhsLength = 0;
for (int i = lhs.nextSetBit(0); i >= 0; i = lhs.nextSetBit(i + 1)) {
lhsLength++;
if (currentNode.getChildren() == null) {
currentNode.setChildren(new FDTreeElement[this.numAttributes]);
currentNode.getChildren()[i] = new FDTreeElement(this.numAttributes);
}
else if (currentNode.getChildren()[i] == null) {
currentNode.getChildren()[i] = new FDTreeElement(this.numAttributes);
}
currentNode = currentNode.getChildren()[i];
currentNode.addRhsAttributes(rhs);
}
currentNode.markFds(rhs);
this.depth = Math.max(this.depth, lhsLength);
return currentNode;
}
示例14: addUniqueColumnCombination
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
public UCCTreeElement addUniqueColumnCombination(OpenBitSet ucc) {
UCCTreeElement currentNode = this;
int uccLength = 0;
for (int i = ucc.nextSetBit(0); i >= 0; i = ucc.nextSetBit(i + 1)) {
uccLength++;
if (currentNode.getChildren() == null) {
currentNode.setChildren(new UCCTreeElement[this.numAttributes]);
currentNode.getChildren()[i] = new UCCTreeElement(this.numAttributes, false);
}
else if (currentNode.getChildren()[i] == null) {
currentNode.getChildren()[i] = new UCCTreeElement(this.numAttributes, false);
}
currentNode = currentNode.getChildren()[i];
}
currentNode.setUCC(true);
this.depth = Math.max(this.depth, uccLength);
return currentNode;
}
示例15: executePara
import org.apache.lucene.util.OpenBitSet; //导入依赖的package包/类
private void executePara(int attribute) throws CouldNotReceiveResultException, ColumnNameMismatchException {
for (OpenBitSet lhs : this.lhss.get(attribute)) {
if (lhs.get(attribute)) {
continue;
}
IntList bits = new IntArrayList();
int lastIndex = lhs.nextSetBit(0);
while (lastIndex != -1) {
bits.add(lastIndex);
lastIndex = lhs.nextSetBit(lastIndex + 1);
}
FunctionalDependencyGroup2 fdg = new FunctionalDependencyGroup2(attribute, bits);
this.fdrr.receiveResult((fdg.buildDependency(this.relationName, this.columns)));
this.result.add(fdg);
}
}
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:19,代码来源:FunctionalDependencyGenerator.java