本文整理汇总了Java中org.apache.lucene.util.OpenBitSet.clear方法的典型用法代码示例。如果您正苦于以下问题:Java OpenBitSet.clear方法的具体用法?Java OpenBitSet.clear怎么用?Java OpenBitSet.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.util.OpenBitSet
的用法示例。
在下文中一共展示了OpenBitSet.clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDeleteGeneralizations
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
@Test
public void testDeleteGeneralizations() {
fdtree = new FDTree(4, -1);
OpenBitSet lhs = new OpenBitSet();
lhs.set(0);
lhs.set(1);
this.fdtree.addFunctionalDependency(lhs, 3);
lhs.clear(1);
lhs.set(2);
this.fdtree.addFunctionalDependency(lhs, 3);
//lhs.set(1);
//this.fdtree.deleteGeneralizations(lhs, 3, 0);
//assertTrue(this.fdtree.isEmpty());
}
示例2: getDocIdSet
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
@Override
public DocIdSet getDocIdSet(IndexReader reader) throws IOException
{
int max = reader.maxDoc();
OpenBitSet good = new OpenBitSet(max);
good.set(0, max);
for( List<Field> values : terms )
{
for( Field nv : values )
{
Term term = new Term(nv.getField(), nv.getValue());
TermDocs docs = reader.termDocs(term);
while( docs.next() )
{
good.clear(docs.doc());
}
docs.close();
}
}
return good;
}
示例3: filterGeneralizations
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public void filterGeneralizations(FDTree filteredTree, OpenBitSet activePath) {
int attr;
for (attr = 1; attr <= maxAttributeNumber; attr++) {
if (isfd[attr - 1]) {
if (!filteredTree.containsGeneralization(activePath, attr, 0)) {
filteredTree.addFunctionalDependency(activePath, attr);
}
}
}
for (attr = maxAttributeNumber; attr > 0; attr--) {
if (children[attr - 1] != null) {
activePath.set(attr);
children[attr - 1].filterGeneralizations(filteredTree, activePath);
activePath.clear(attr);
}
}
}
示例4: getLhsAndGeneralizations
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
protected void getLhsAndGeneralizations(OpenBitSet lhs, int currentLhsAttr, OpenBitSet currentLhs, List<OpenBitSet> foundLhs) {
if (this.children == null) {
foundLhs.add(currentLhs.clone());
return;
}
while (currentLhsAttr >= 0) {
int nextLhsAttr = lhs.nextSetBit(currentLhsAttr + 1);
if (this.children[currentLhsAttr] != null) {
currentLhs.set(currentLhsAttr);
this.children[currentLhsAttr].getLhsAndGeneralizations(lhs, nextLhsAttr, currentLhs, foundLhs);
currentLhs.clear(currentLhsAttr);
}
currentLhsAttr = nextLhsAttr;
}
}
示例5: testContainsSpezialization
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
@Test
public void testContainsSpezialization() {
FDTree fdtree = new FDTree(5);
OpenBitSet lhs = new OpenBitSet();
lhs.set(1);
lhs.set(3);
lhs.set(5);
fdtree.addFunctionalDependency(lhs, 4);
lhs.clear(1);
lhs.set(2);
fdtree.addFunctionalDependency(lhs, 4);
lhs.clear(3);
boolean result = fdtree.containsSpecialization(lhs, 4, 0);
assertTrue(result);
}
示例6: 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;
}
示例7: specializePositiveCover
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
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;
}
示例8: 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);
}
}
}
}
示例9: getLevel
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public void getLevel(int level, int currentLevel, OpenBitSet currentLhs, List<FDTreeElementLhsPair> result) {
if (level == currentLevel) {
result.add(new FDTreeElementLhsPair(this, currentLhs.clone()));
}
else {
currentLevel++;
if (this.children == null)
return;
for (int child = 0; child < this.numAttributes; child++) {
if (this.children[child] == null)
continue;
currentLhs.set(child);
this.children[child].getLevel(level, currentLevel, currentLhs, result);
currentLhs.clear(child);
}
}
}
示例10: 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);
FunctionalDependency fdResult = new 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);
}
}
}
示例11: calculatePositiveCover
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
private void calculatePositiveCover(FDTreeElement negCoverSubtree, OpenBitSet activePath) {
for (int attr = 1; attr <= numberAttributes; attr++) {
if (negCoverSubtree.isFd(attr - 1)) {
OpenBitSet test = new OpenBitSet();
test.set(1);
specializePositiveCover(activePath, attr);
}
}
for (int attr = 1; attr <= numberAttributes; attr++) {
if (negCoverSubtree.getChild(attr - 1) != null) {
activePath.set(attr);
this.calculatePositiveCover(negCoverSubtree.getChild(attr - 1), activePath);
activePath.clear(attr);
}
}
}
示例12: 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);
}
}
}
示例13: asBitSetList
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
protected void asBitSetList(OpenBitSet currentLhs, int currentLhsAttr, List<OpenBitSet> foundLhs) {
if (this.children == null) {
foundLhs.add(currentLhs.clone());
return;
}
for (int lhsAttr = currentLhsAttr; lhsAttr < this.children.length; lhsAttr++) {
if (this.children[lhsAttr] != null) {
currentLhs.set(lhsAttr);
this.children[lhsAttr].asBitSetList(currentLhs, lhsAttr + 1, foundLhs);
currentLhs.clear(lhsAttr);
}
}
}
示例14: fetchBitSets
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
protected void fetchBitSets(Set<OpenBitSet> posCoverTree, FDTreeElement negCoverSubtree, OpenBitSet activePath) {
posCoverTree.add(activePath.clone());
if (negCoverSubtree.getChildren() != null) {
for (int attr = 0; attr < this.numAttributes; attr++) {
if (negCoverSubtree.getChildren()[attr] != null) {
activePath.set(attr);
this.fetchBitSets(posCoverTree, negCoverSubtree.getChildren()[attr], activePath);
activePath.clear(attr);
}
}
}
}
示例15: addToIndex
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
protected void addToIndex(Int2ObjectOpenHashMap<ArrayList<ElementLhsPair>> level2elements, int level, OpenBitSet lhs) {
level2elements.get(level).add(new ElementLhsPair(this, lhs.clone()));
if (this.children != null) {
for (int childAttr = 0; childAttr < this.numAttributes; childAttr++) {
FDTreeElement element = this.children[childAttr];
if (element != null) {
lhs.set(childAttr);
element.addToIndex(level2elements, level + 1, lhs);
lhs.clear(childAttr);
}
}
}
}