本文整理汇总了Java中org.apache.lucene.util.OpenBitSet.set方法的典型用法代码示例。如果您正苦于以下问题:Java OpenBitSet.set方法的具体用法?Java OpenBitSet.set怎么用?Java OpenBitSet.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.util.OpenBitSet
的用法示例。
在下文中一共展示了OpenBitSet.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: violatedFds
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
/**
* Find the least general functional dependencies violated by t1 and t2
* and add update the negative cover accordingly.<br/>
* Note: t1 and t2 must have the same length.
*
* @param t1 An ObjectArrayList with the values of one entry of the relation.
* @param t2 An ObjectArrayList with the values of another entry of the relation.
*/
private void violatedFds(List<String> t1, List<String> t2) {
OpenBitSet equalAttr = new OpenBitSet();
equalAttr.set(1, this.numberAttributes + 1);
OpenBitSet diffAttr = new OpenBitSet();
for (int i = 0; i < t1.size(); i++) {
Object val1 = t1.get(i);
Object val2 = t2.get(i);
// Handling of null values. Currently assuming NULL values are equal.
if (val1 == null && val2 == null) {
continue;
} else if ((val1 == null && val2 != null) || !(val1.equals(val2))) {
// OpenBitSet start with 1 for first attribute
diffAttr.set(i + 1);
}
}
equalAttr.andNot(diffAttr);
for (int a = diffAttr.nextSetBit(0); a >= 0; a = diffAttr.nextSetBit(a + 1)) {
negCoverTree.addFunctionalDependency(equalAttr, a);
}
}
示例3: 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());
}
示例4: 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;
}
}
示例5: 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;
}
示例6: 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;
}
}
示例7: calculatePositiveCover
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
protected void calculatePositiveCover(FDTree posCoverTree, FDTreeElement negCoverSubtree, OpenBitSet activePath) {
OpenBitSet fds = negCoverSubtree.getFds();
for (int rhs = fds.nextSetBit(0); rhs >= 0; rhs = fds.nextSetBit(rhs + 1))
this.specializePositiveCover(posCoverTree, activePath, rhs);
if (negCoverSubtree.getChildren() != null) {
for (int attr = 0; attr < this.numAttributes; attr++) {
if (negCoverSubtree.getChildren()[attr] != null) {
activePath.set(attr);
this.calculatePositiveCover(posCoverTree, negCoverSubtree.getChildren()[attr], activePath);
activePath.clear(attr);
}
}
}
}
示例8: 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);
Institution institution = CurrentInstitution.get();
Term term = new Term(FreeTextQuery.FIELD_INSTITUTION, Long.toString(institution.getUniqueId()));
TermDocs docs = reader.termDocs(term);
while( docs.next() )
{
good.set(docs.doc());
}
docs.close();
return good;
}
示例9: addFunctionalDependenciesInto
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public int addFunctionalDependenciesInto(FunctionalDependencyResultReceiver resultReceiver, OpenBitSet lhs, ObjectArrayList<ColumnIdentifier> columnIdentifiers, List<PositionListIndex> plis) throws CouldNotReceiveResultException, ColumnNameMismatchException {
int numFDs = 0;
for (int rhs = this.rhsFds.nextSetBit(0); rhs >= 0; rhs = this.rhsFds.nextSetBit(rhs + 1)) {
ColumnIdentifier[] columns = new ColumnIdentifier[(int) lhs.cardinality()];
int j = 0;
for (int i = lhs.nextSetBit(0); i >= 0; i = lhs.nextSetBit(i + 1)) {
int columnId = plis.get(i).getAttribute(); // Here we translate the column i back to the real column i before the sorting
columns[j++] = columnIdentifiers.get(columnId);
}
ColumnCombination colCombination = new ColumnCombination(columns);
int rhsId = plis.get(rhs).getAttribute(); // Here we translate the column rhs back to the real column rhs before the sorting
FunctionalDependency fdResult = new FunctionalDependency(colCombination, columnIdentifiers.get(rhsId));
resultReceiver.receiveResult(fdResult);
numFDs++;
}
if (this.getChildren() == null)
return numFDs;
for (int childAttr = 0; childAttr < this.numAttributes; childAttr++) {
FDTreeElement element = this.getChildren()[childAttr];
if (element != null) {
lhs.set(childAttr);
numFDs += element.addFunctionalDependenciesInto(resultReceiver, lhs, columnIdentifiers, plis);
lhs.clear(childAttr);
}
}
return numFDs;
}
示例10: 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);
}
}
}
}
示例11: testContainsGeneralization
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
@Test
public void testContainsGeneralization() {
OpenBitSet lhs = new OpenBitSet();
lhs.set(0);
lhs.set(1);
assertFalse(this.fdtree.containsFdOrGeneralization(lhs, 2));
lhs.set(3);
lhs.set(4);
assertTrue(this.fdtree.containsFdOrGeneralization(lhs, 2));
}
示例12: testContainsSpecialization
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
@Test
public void testContainsSpecialization() {
OpenBitSet lhs = new OpenBitSet();
lhs.set(1);
lhs.set(2);
assertTrue(fdtree.containsSpecialization(lhs, 3, 0));
}
示例13: 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)) {
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);
}
}
}
示例14: testGetSpecialization
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
@Test
public void testGetSpecialization() {
OpenBitSet lhs = new OpenBitSet();
lhs.set(1);
lhs.set(2);
OpenBitSet specLhs = new OpenBitSet();
assertTrue(fdtree.getSpecialization(lhs, 3, 0, specLhs));
OpenBitSet expResult = new OpenBitSet();
expResult.set(1);
expResult.set(2);
expResult.set(4);
assertEquals(expResult, specLhs);
}
示例15: asBitSets
import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public void asBitSets(ArrayList<OpenBitSet> bitsets, OpenBitSet bitset, int thisAttribute) {
bitset.set(thisAttribute);
if (this.end)
bitsets.add(bitset.clone());
for (int i = thisAttribute; i < this.children.length; i++)
if (this.children[i] != null)
this.children[i].asBitSets(bitsets, bitset, i);
bitset.clear(thisAttribute);
}