本文整理汇总了Java中org.apache.lucene.util.OpenBitSet.nextSetBit方法的典型用法代码示例。如果您正苦于以下问题:Java OpenBitSet.nextSetBit方法的具体用法?Java OpenBitSet.nextSetBit怎么用?Java OpenBitSet.nextSetBit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.util.OpenBitSet
的用法示例。
在下文中一共展示了OpenBitSet.nextSetBit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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);
}
示例4: addOneSmallerGeneralizations
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
/**
* Checks, whether the dependent attribute ends in the current tree element.
*
* @param rhs
* the i'th dependent attribute.
* @return true, if the tree element does not have any children with the
* same dependent attribute. false, otherwise.
*/
/* public boolean isLastNodeOf(int rhs) {
if (!this.hasRhsAttribute(rhs))
return false;
// Check all children for the rhs
for (int attr = 0; attr < this.maxAttributeNumber; attr++)
if ((this.children[attr] != null) && (this.children[attr].hasRhsAttribute(rhs)))
return false;
return true;
}
*/
// FUDEBS
protected void addOneSmallerGeneralizations(OpenBitSet currentLhs, int maxCurrentLhsAttribute, int rhs, FDTree tree) {
for (int lhsAttribute = currentLhs.nextSetBit(0); lhsAttribute != maxCurrentLhsAttribute; lhsAttribute = currentLhs.nextSetBit(lhsAttribute + 1)) {
currentLhs.clear(lhsAttribute);
tree.addGeneralization(currentLhs, rhs);
currentLhs.set(lhsAttribute);
}
}
示例5: getFdOrGeneralization
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
protected boolean getFdOrGeneralization(OpenBitSet lhs, int rhs, int currentLhsAttr, OpenBitSet foundLhs) {
if (this.isFd(rhs))
return true;
// Is the dependency already read and we have not yet found a generalization?
if (currentLhsAttr < 0)
return false;
int nextLhsAttr = lhs.nextSetBit(currentLhsAttr + 1);
if ((this.children != null) && (this.children[currentLhsAttr] != null) && (this.children[currentLhsAttr].hasRhsAttribute(rhs))) {
if (this.children[currentLhsAttr].getFdOrGeneralization(lhs, rhs, nextLhsAttr, foundLhs)) {
foundLhs.set(currentLhsAttr);
return true;
}
}
return this.getFdOrGeneralization(lhs, rhs, nextLhsAttr, foundLhs);
}
示例6: buildClusterIdentifier
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
protected ClusterIdentifier buildClusterIdentifier(int recordId, int[][] invertedPlis, OpenBitSet lhs, int lhsSize) {
int[] cluster = new int[lhsSize];
int index = 0;
for (int lhsAttr = lhs.nextSetBit(0); lhsAttr >= 0; lhsAttr = lhs.nextSetBit(lhsAttr + 1)) {
int clusterId = invertedPlis[lhsAttr][recordId];
if (clusterId < 0)
return null;
cluster[index] = clusterId;
index++;
}
return new ClusterIdentifier(cluster);
}
示例7: 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;
}
示例8: addAllDependenciesToResultReceiver
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
private void addAllDependenciesToResultReceiver(FDTreeElement fds, OpenBitSet activePath) throws CouldNotReceiveResultException, ColumnNameMismatchException {
if (this.fdResultReceiver == null) {
return;
}
for (int attr = 1; attr <= numberAttributes; attr++) {
if (fds.isFd(attr - 1)) {
int j = 0;
ColumnIdentifier[] columns = new ColumnIdentifier[(int) activePath.cardinality()];
for (int i = activePath.nextSetBit(0); i >= 0; i = activePath.nextSetBit(i + 1)) {
columns[j++] = this.columnIdentifiers.get(i - 1);
}
ColumnCombination colCombination = new ColumnCombination(columns);
de.metanome.algorithm_integration.results.FunctionalDependency fdResult = new de.metanome.algorithm_integration.results.FunctionalDependency(colCombination, columnIdentifiers.get((int) attr - 1));
// System.out.println(fdResult.toString());
fdResultReceiver.receiveResult(fdResult);
}
}
for (int attr = 1; attr <= numberAttributes; attr++) {
if (fds.getChild(attr - 1) != null) {
activePath.set(attr);
this.addAllDependenciesToResultReceiver(fds.getChild(attr - 1), activePath);
activePath.clear(attr);
}
}
}
示例9: containsSpecialization
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
/**
* Return, whether the tree element contains a specialization of the functional dependency lhs -> a. </br>
*
* @param lhs The left-hand-side attribute set of the functional dependency.
* @param a The dependent attribute.
* @param currentAttr The last attribute from the left-hand-side attributes, which has already been checked.
* This attribute and all smaller ones have already been found in the path. </br>
* Only use values from 0 to maxAttributeNumber.
* 0 is only used if no attribute is checked yet.
* @return true, if the element contains a specialization of the functional dependency lhs -> a.
* false otherwise.
*/
public boolean containsSpecialization(OpenBitSet lhs, int a, int currentAttr) {
if (!rhsAttributes.get(a)) {
return false;
}
// is the dependency already covered?
int nextSetAttribute = lhs.nextSetBit(currentAttr + 1);
if (nextSetAttribute < 0) {
return true;
}
// attributes start with 1.
int attr = Math.max(currentAttr, 1);
boolean found = false;
while (!found && attr <= nextSetAttribute) {
if (children[attr - 1] != null) {
if (children[attr - 1].getRhsAttributes().get(a)) {
if (attr < nextSetAttribute) {
// Try next vertex with currentAttr.
found = children[attr - 1].containsSpecialization(lhs, a, currentAttr);
} else if (attr == nextSetAttribute) {
// Found nextSetAttribute in the path. Check child for the following set attribute.
found = children[nextSetAttribute - 1].containsSpecialization(lhs, a, nextSetAttribute);
}
}
}
attr++;
}
return found;
}
示例10: convertToIntList
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public static IntList convertToIntList(OpenBitSet set) {
IntList bits = new IntArrayList();
int lastIndex = set.nextSetBit(0);
while (lastIndex != -1) {
bits.add(lastIndex);
lastIndex = set.nextSetBit(lastIndex + 1);
}
return bits;
}
示例11: getUCCAndGeneralizations
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public List<OpenBitSet> getUCCAndGeneralizations(OpenBitSet ucc) {
List<OpenBitSet> foundUCCs = new ArrayList<>();
OpenBitSet currentUCC = new OpenBitSet();
int nextUCCAttr = ucc.nextSetBit(0);
this.getUCCAndGeneralizations(ucc, nextUCCAttr, currentUCC, foundUCCs);
return foundUCCs;
}
示例12: ClusterTreeElement
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public ClusterTreeElement(int[][] compressedRecords, OpenBitSet lhs, int nextLhsAttr, int recordId, int content) {
if (nextLhsAttr < 0) {
this.content = content;
}
else {
int nextCluster = compressedRecords[recordId][nextLhsAttr];
if (nextCluster < 0)
return;
ClusterTreeElement child = new ClusterTreeElement(compressedRecords, lhs, lhs.nextSetBit(nextLhsAttr + 1), recordId, content);
this.children.put(nextCluster, child);
}
}
示例13: updatePositiveCover
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public void updatePositiveCover(FDList nonFds) {
/* if (nonFds.isEmpty())
return;
// Sort the negative cover
Logger.getInstance().writeln("Sorting FD-violations ...");
Collections.sort(nonFds, new Comparator<OpenBitSet>() {
@Override
public int compare(OpenBitSet o1, OpenBitSet o2) {
return (int)(o1.cardinality() - o2.cardinality());
}
});
*/ // THE SORTING IS NOT NEEDED AS THE UCCSet SORTS THE NONUCCS BY LEVEL ALREADY
Logger.getInstance().writeln("Inducing FD candidates ...");
for (int i = nonFds.getFdLevels().size() - 1; i >= 0; i--) {
if (i >= nonFds.getFdLevels().size()) // If this level has been trimmed during iteration
continue;
List<OpenBitSet> nonFdLevel = nonFds.getFdLevels().get(i);
for (OpenBitSet lhs : nonFdLevel) {
OpenBitSet fullRhs = lhs.clone();
fullRhs.flip(0, this.posCover.getNumAttributes());
for (int rhs = fullRhs.nextSetBit(0); rhs >= 0; rhs = fullRhs.nextSetBit(rhs + 1))
this.specializePositiveCover(lhs, rhs, nonFds);
}
nonFdLevel.clear();
}
}
示例14: getFdAndGeneralizations
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public List<OpenBitSet> getFdAndGeneralizations(OpenBitSet lhs, int rhs) {
List<OpenBitSet> foundLhs = new ArrayList<>();
OpenBitSet currentLhs = new OpenBitSet();
int nextLhsAttr = lhs.nextSetBit(0);
this.getFdAndGeneralizations(lhs, rhs, nextLhsAttr, currentLhs, foundLhs);
return foundLhs;
}
示例15: getLastSetBitIndex
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
private long getLastSetBitIndex(OpenBitSet bitset) {
int lastSetBit = 0;
for (int A = bitset.nextSetBit(0); A >= 0; A = bitset.nextSetBit(A + 1)) {
lastSetBit = A;
}
return lastSetBit;
}
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:8,代码来源:TaneAlgorithmFilterTreeDirect.java