当前位置: 首页>>代码示例>>Java>>正文


Java OpenBitSet.andNot方法代码示例

本文整理汇总了Java中org.apache.lucene.util.OpenBitSet.andNot方法的典型用法代码示例。如果您正苦于以下问题:Java OpenBitSet.andNot方法的具体用法?Java OpenBitSet.andNot怎么用?Java OpenBitSet.andNot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.util.OpenBitSet的用法示例。


在下文中一共展示了OpenBitSet.andNot方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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);
    }
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:29,代码来源:FdepAlgorithm.java

示例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(int[] t1, int[] t2) {
    OpenBitSet equalAttr = new OpenBitSet();
    equalAttr.set(1, this.numberAttributes + 1);
    OpenBitSet diffAttr = new OpenBitSet();
    for (int i = 0; i < t1.length; i++) {
        int val1 = t1[i];
        int val2 = t2[i];
        // TODO: Handling of null values. Currently assuming NULL values are equal.
        if (val1 != 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);
    }
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:27,代码来源:FdepAlgorithmHashValues.java

示例3: addFunctionalDependencyIfNotInvalid

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public FDTreeElement addFunctionalDependencyIfNotInvalid(OpenBitSet lhs, OpenBitSet rhs) {
	FDTreeElement currentNode = this;
	currentNode.addRhsAttributes(rhs);

	OpenBitSet invalidFds = currentNode.rhsAttributes.clone();
	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];
		invalidFds.and(currentNode.rhsFds);
		currentNode.addRhsAttributes(rhs);
	}
	
	rhs.andNot(invalidFds);
	currentNode.markFds(rhs);
	rhs.or(invalidFds);

	this.depth = Math.max(this.depth, lhsLength);
	return currentNode;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:30,代码来源:FDTree.java

示例4: addViolatedFdsToCover

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
/**
 * Find the least general functional dependencies violated by t1 and t2 and update the negative cover accordingly.
 * Note: t1 and t2 must have the same length.
 */
protected void addViolatedFdsToCover(int[] t1, int[] t2, FDTree negCoverTree) {
	OpenBitSet equalAttrs = new OpenBitSet(t1.length);
	for (int i = 0; i < t1.length; i++)
		if (this.valueComparator.isEqual(t1[i], t2[i]))
			equalAttrs.set(i);
	
	OpenBitSet diffAttrs = new OpenBitSet(t1.length);
	diffAttrs.set(0, this.numAttributes);
	diffAttrs.andNot(equalAttrs);
	
	negCoverTree.addFunctionalDependency(equalAttrs, diffAttrs);
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:17,代码来源:FDEP.java

示例5: computeDependencies

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
private void computeDependencies(int l) throws AlgorithmExecutionException {
    initializeCplusForLevel();

    // iterate through the combinations of the level
    for (OpenBitSet X : level1.keySet()) {
        // Build the intersection between X and C_plus(X)
        OpenBitSet C_plus = level1.get(X).getRhsCandidates();
        OpenBitSet intersection = (OpenBitSet) X.clone();
        intersection.intersect(C_plus);

        // clone of X for usage in the following loop
        OpenBitSet Xclone = (OpenBitSet) X.clone();

        // iterate through all elements (A) of the intersection
        for (int A = intersection.nextSetBit(0); A >= 0; A = intersection.nextSetBit(A + 1)) {
            Xclone.clear(A);

            // check if X\A -> A is valid
            StrippedPartition spXwithoutA = level0.get(Xclone).getPartition();
            StrippedPartition spX = level1.get(X).getPartition();

            if (spX.getError() == spXwithoutA.getError()) {
                // add fd to FDTree. Filter the tree at the end of the algorithm.
                dependencies.addFunctionalDependency(Xclone, A);


                // remove A from C_plus(X)
                level1.get(X).getRhsCandidates().clear(A);

                // remove all B in R\X from C_plus(X)
                OpenBitSet RwithoutX = new OpenBitSet();
                // set to R
                RwithoutX.set(1, numberAttributes + 1);
                // remove X
                RwithoutX.andNot(X);

                for (int i = RwithoutX.nextSetBit(0); i >= 0; i = RwithoutX.nextSetBit(i + 1)) {
                    level1.get(X).getRhsCandidates().clear(i);
                }

            }
            Xclone.set(A);
        }
    }
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:46,代码来源:TaneAlgorithmFilterTreeEnd.java

示例6: computeDependencies

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
/**
 * Computes the dependencies for the current level (level1).
 *
 * @throws AlgorithmExecutionException
 */
private void computeDependencies() throws AlgorithmExecutionException {
    initializeCplusForLevel();

    // iterate through the combinations of the level
    for (OpenBitSet X : level1.keySet()) {
        if (level1.get(X).isValid()) {
            // Build the intersection between X and C_plus(X)
            OpenBitSet C_plus = level1.get(X).getRhsCandidates();
            OpenBitSet intersection = (OpenBitSet) X.clone();
            intersection.intersect(C_plus);

            // clone of X for usage in the following loop
            OpenBitSet Xclone = (OpenBitSet) X.clone();

            // iterate through all elements (A) of the intersection
            for (int A = intersection.nextSetBit(0); A >= 0; A = intersection.nextSetBit(A + 1)) {
                Xclone.clear(A);

                // check if X\A -> A is valid
                StrippedPartition spXwithoutA = level0.get(Xclone).getPartition();
                StrippedPartition spX = level1.get(X).getPartition();

                if (spX.getError() == spXwithoutA.getError()) {
                    // found Dependency
                    OpenBitSet XwithoutA = (OpenBitSet) Xclone.clone();
                    processFunctionalDependency(XwithoutA, A);

                    // remove A from C_plus(X)
                    level1.get(X).getRhsCandidates().clear(A);

                    // remove all B in R\X from C_plus(X)
                    OpenBitSet RwithoutX = new OpenBitSet();
                    // set to R
                    RwithoutX.set(1, numberAttributes + 1);
                    // remove X
                    RwithoutX.andNot(X);

                    for (int i = RwithoutX.nextSetBit(0); i >= 0; i = RwithoutX.nextSetBit(i + 1)) {
                        level1.get(X).getRhsCandidates().clear(i);
                    }

                }
                Xclone.set(A);
            }
        }
    }
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:53,代码来源:TaneAlgorithm.java

示例7: computeDependencies

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
private void computeDependencies(int l) throws AlgorithmExecutionException {
    initializeCplusForLevel();

    // iterate through the combinations of the level
    for (OpenBitSet X : level1.keySet()) {
        // Build the intersection between X and C_plus(X)
        OpenBitSet C_plus = level1.get(X).getRhsCandidates();
        OpenBitSet intersection = (OpenBitSet) X.clone();
        intersection.intersect(C_plus);

        // clone of X for usage in the following loop
        OpenBitSet Xclone = (OpenBitSet) X.clone();

        // iterate through all elements (A) of the intersection
        for (int A = intersection.nextSetBit(0); A >= 0; A = intersection.nextSetBit(A + 1)) {
            Xclone.clear(A);

            // check if X\A -> A is valid
            StrippedPartition spXwithoutA = level0.get(Xclone).getPartition();
            StrippedPartition spX = level1.get(X).getPartition();

            if (spX.getError() == spXwithoutA.getError()) {
                // Add dependency to the result receiver as well as to the FDTree (dependencies),
                // which is used to check, whether a more general dependency already exists.
                OpenBitSet XwithoutA = (OpenBitSet) Xclone.clone();
                addDependencyToResultReceiver(XwithoutA, A);
                dependencies.addFunctionalDependency(Xclone, A);


                // remove A from C_plus(X)
                level1.get(X).getRhsCandidates().clear(A);

                // remove all B in R\X from C_plus(X)
                OpenBitSet RwithoutX = new OpenBitSet();
                // set to R
                RwithoutX.set(1, numberAttributes + 1);
                // remove X
                RwithoutX.andNot(X);

                for (int i = RwithoutX.nextSetBit(0); i >= 0; i = RwithoutX.nextSetBit(i + 1)) {
                    level1.get(X).getRhsCandidates().clear(i);
                }

            }
            Xclone.set(A);
        }
    }
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:49,代码来源:TaneAlgorithmFilterTreeDirect.java

示例8: call

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public ValidationResult call() throws Exception {
	ValidationResult result = new ValidationResult();
	
	FDTreeElement element = this.elementLhsPair.getElement();
	OpenBitSet lhs = this.elementLhsPair.getLhs();
	OpenBitSet rhs = element.getFds();
	
	int rhsSize = (int) rhs.cardinality();
	if (rhsSize == 0)
		return result;
	result.validations = result.validations + rhsSize;
	
	if (Validator.this.level == 0) {
		// Check if rhs is unique
		for (int rhsAttr = rhs.nextSetBit(0); rhsAttr >= 0; rhsAttr = rhs.nextSetBit(rhsAttr + 1)) {
			if (!Validator.this.plis.get(rhsAttr).isConstant(Validator.this.numRecords)) {
				element.removeFd(rhsAttr);
				result.invalidFDs.add(new FD(lhs, rhsAttr));
			}
			result.intersections++;
		}
	}
	else if (Validator.this.level == 1) {
		// Check if lhs from plis refines rhs
		int lhsAttribute = lhs.nextSetBit(0);
		for (int rhsAttr = rhs.nextSetBit(0); rhsAttr >= 0; rhsAttr = rhs.nextSetBit(rhsAttr + 1)) {
			if (!Validator.this.plis.get(lhsAttribute).refines(Validator.this.compressedRecords, rhsAttr)) {
				element.removeFd(rhsAttr);
				result.invalidFDs.add(new FD(lhs, rhsAttr));
			}
			result.intersections++;
		}
	}
	else {
		// Check if lhs from plis plus remaining inverted plis refines rhs
		int firstLhsAttr = lhs.nextSetBit(0);
		
		lhs.clear(firstLhsAttr);
		OpenBitSet validRhs = Validator.this.plis.get(firstLhsAttr).refines(Validator.this.compressedRecords, lhs, rhs, result.comparisonSuggestions);
		lhs.set(firstLhsAttr);
		
		result.intersections++;
		
		rhs.andNot(validRhs); // Now contains all invalid FDs
		element.setFds(validRhs); // Sets the valid FDs in the FD tree
		
		for (int rhsAttr = rhs.nextSetBit(0); rhsAttr >= 0; rhsAttr = rhs.nextSetBit(rhsAttr + 1))
			result.invalidFDs.add(new FD(lhs, rhsAttr));
	}
	return result;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:52,代码来源:Validator.java


注:本文中的org.apache.lucene.util.OpenBitSet.andNot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。