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


Java OpenBitSet.cardinality方法代码示例

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


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

示例1: isUniqueWith

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public boolean isUniqueWith(int[][] compressedRecords, OpenBitSet otherAttrs, List<IntegerPair> comparisonSuggestions) {
	int attrsSize = (int) otherAttrs.cardinality();
	
	for (IntArrayList cluster : this.clusters) {
		Object2IntOpenHashMap<ClusterIdentifier> value2record = new Object2IntOpenHashMap<>(cluster.size());
		for (int recordId : cluster) {
			ClusterIdentifier value = this.buildClusterIdentifier(otherAttrs, attrsSize, compressedRecords[recordId]);
			if (value == null)
				continue;
			if (value2record.containsKey(value)) {
				comparisonSuggestions.add(new IntegerPair(recordId, value2record.getInt(value)));
				return false;
			}
			value2record.put(value, recordId);
		}
	}
	return true;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:19,代码来源:PositionListIndex.java

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

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

示例4: addFunctionalDependenciesInto

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public void addFunctionalDependenciesInto(List<FunctionalDependency> functionalDependencies, OpenBitSet lhs, ObjectArrayList<ColumnIdentifier> columnIdentifiers, List<PositionListIndex> plis) {
	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));
		functionalDependencies.add(fdResult);
	}

	if (this.getChildren() == null)
		return;
		
	for (int childAttr = 0; childAttr < this.numAttributes; childAttr++) {
		FDTreeElement element = this.getChildren()[childAttr];
		if (element != null) {
			lhs.set(childAttr);
			element.addFunctionalDependenciesInto(functionalDependencies, lhs, columnIdentifiers, plis);
			lhs.clear(childAttr);
		}
	}
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:28,代码来源:FDTreeElement.java

示例5: addAllDependenciesToResultReceiver

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
/**
     * Adds all functional dependencies in the subtree fds to the resultReceiver.
     *
     * @param fds
     * @param activePath
     * @throws CouldNotReceiveResultException
     * @throws ColumnNameMismatchException 
     */
    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);
            }
        }
    }
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:35,代码来源:TaneAlgorithmFilterTreeEnd.java

示例6: addDependencyToResultReceiver

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
/**
 * Add the functional dependency to the ResultReceiver.
 *
 * @param X: A OpenBitSet representing the Columns of the determinant.
 * @param a: The number of the dependent column (starting from 1).
 * @throws CouldNotReceiveResultException if the result receiver cannot handle the functional dependency.
 * @throws ColumnNameMismatchException 
 */
private void addDependencyToResultReceiver(OpenBitSet X, int a) throws CouldNotReceiveResultException, ColumnNameMismatchException {
    if (this.fdResultReceiver == null) {
        return;
    }
    ColumnIdentifier[] columns = new ColumnIdentifier[(int) X.cardinality()];
    int j = 0;
    for (int i = X.nextSetBit(0); i >= 0; i = X.nextSetBit(i + 1)) {
        columns[j++] = this.columnIdentifiers.get(i - 1);
    }
    ColumnCombination colCombination = new ColumnCombination(columns);
    FunctionalDependency fdResult = new FunctionalDependency(colCombination, columnIdentifiers.get((int) a - 1));
    this.fdResultReceiver.receiveResult(fdResult);
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:22,代码来源:TaneAlgorithm.java

示例7: addDependencyToResultReceiver

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
/**
 * Add the functional dependency to the ResultReceiver.
 *
 * @param X: A OpenBitSet representing the Columns of the determinant.
 * @param a: The number of the dependent column (starting from 1).
 * @throws CouldNotReceiveResultException
 * @throws ColumnNameMismatchException 
 */
private void addDependencyToResultReceiver(OpenBitSet X, int a) throws CouldNotReceiveResultException, ColumnNameMismatchException {
    if (this.fdResultReceiver == null) {
        return;
    }
    ColumnIdentifier[] columns = new ColumnIdentifier[(int) X.cardinality()];
    int j = 0;
    for (int i = X.nextSetBit(0); i >= 0; i = X.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) a - 1));
    this.fdResultReceiver.receiveResult(fdResult);
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:22,代码来源:TaneAlgorithmFilterTreeDirect.java

示例8: addAllDependenciesToResultReceiver

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
/**
     * Adds all functional dependencies in the subtree fds to the resultReceiver.
     *
     * @param fds
     * @param activePath
     * @throws CouldNotReceiveResultException
     * @throws ColumnNameMismatchException 
     */
    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);
            }
        }
    }
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:35,代码来源:TaneAlgorithmFilterTreeDirect.java

示例9: grow

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public void grow(OpenBitSet lhs, FDTree fdTree) {
	// Add specializations of all nodes an mark them as isFD, but if specialization exists, then it is invalid and should not be marked; only add specializations of nodes not marked as isFD!
	OpenBitSet rhs = this.rhsAttributes;
	
	OpenBitSet invalidRhs = rhs.clone();
	invalidRhs.remove(this.rhsFds);
	
	// Add specializations that are not invalid
	if (invalidRhs.cardinality() > 0) {
		for (int extensionAttr = 0; extensionAttr < this.numAttributes; extensionAttr++) {
			if (lhs.get(extensionAttr) || rhs.get(extensionAttr))
				continue;
			
			lhs.set(extensionAttr);
			fdTree.addFunctionalDependencyIfNotInvalid(lhs, invalidRhs);
			lhs.clear(extensionAttr);
		}
	}
	
	// Traverse children and let them add their specializations
	if (this.children != null) {
		for (int childAttr = 0; childAttr < this.numAttributes; childAttr++) {
			FDTreeElement element = this.children[childAttr];
			if (element != null) {
				lhs.set(childAttr);
				element.grow(lhs, fdTree);
				lhs.clear(childAttr);
			}
		}
	}
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:32,代码来源:FDTreeElement.java

示例10: recurseTerms

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
private void recurseTerms(List<List<TermBitSet>> bitSets, int index, String[] curValues, OpenBitSet curBits,
	MatrixResults results, IndexReader reader, boolean countOnly)
{
	List<TermBitSet> termBitSetList = bitSets.get(index);
	boolean last = index == curValues.length - 1;
	for( TermBitSet termBitSet : termBitSetList )
	{
		OpenBitSet termBits = termBitSet.bitSet;
		Term term = termBitSet.term;
		// if we don't intersect there's no point in recursing further in
		if( curBits.intersects(termBits) )
		{
			// Collect current term's value into the value array
			curValues[index] = term.text();
			OpenBitSet docBits = (OpenBitSet) curBits.clone();
			docBits.and(termBits);
			if( last )
			{
				int count;
				List<ItemIdKey> ids = null;
				ArrayList<String> vals = new ArrayList<String>(Arrays.asList(curValues));
				if( !countOnly )
				{
					ids = getIdsForBitset(docBits, reader);
					count = ids.size();
				}
				else
				{
					count = (int) docBits.cardinality();
				}
				results.addEntry(new MatrixResults.MatrixEntry(vals, ids, count));
			}
			else
			{
				recurseTerms(bitSets, index + 1, curValues, docBits, results, reader, countOnly);
			}
		}
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:40,代码来源:ItemIndex.java

示例11: specializePositiveCover

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
protected int specializePositiveCover(OpenBitSet nonUCC, UCCList nonUCCs) {
	int numAttributes = this.posCover.getChildren().length;
	int newUCCs = 0;
	List<OpenBitSet> specUCCs;
	
	if (!(specUCCs = this.posCover.getUCCAndGeneralizations(nonUCC)).isEmpty()) { // TODO: May be "while" instead of "if"?
		for (OpenBitSet specUCC : specUCCs) {
			this.posCover.removeUniqueColumnCombination(specUCC);
			
			if ((this.posCover.getMaxDepth() > 0) && (specUCC.cardinality() >= this.posCover.getMaxDepth()))
				continue;
			
			for (int attr = numAttributes - 1; attr >= 0; attr--) {
				if (!nonUCC.get(attr)) {
					specUCC.set(attr);
					if (!this.posCover.containsUCCOrGeneralization(specUCC)) {
						this.posCover.addUniqueColumnCombination(specUCC);
						newUCCs++;	
						
						// If dynamic memory management is enabled, frequently check the memory consumption and trim the positive cover if it does not fit anymore
						this.memoryGuardian.memoryChanged(1);
						this.memoryGuardian.match(this.negCover, this.posCover, nonUCCs);
					}
					specUCC.clear(attr);
				}
			}
		}
	}
	return newUCCs;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:31,代码来源:Inductor.java

示例12: add

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public boolean add(OpenBitSet ucc) {
	int length = (int) ucc.cardinality();
	
	if ((this.maxDepth > 0) && (length > this.maxDepth))
		return false;
	
	this.depth = Math.max(this.depth, length);
	return this.uccLevels.get(length).add(ucc);
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:10,代码来源:UCCList.java

示例13: addUniqueColumnCombinationsInto

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public int addUniqueColumnCombinationsInto(UniqueColumnCombinationResultReceiver resultReceiver, OpenBitSet ucc, ObjectArrayList<ColumnIdentifier> columnIdentifiers, List<PositionListIndex> plis) throws CouldNotReceiveResultException, ColumnNameMismatchException {
	int numUCCs = 0;
	if (this.isUCC) {
		ColumnIdentifier[] columns = new ColumnIdentifier[(int) ucc.cardinality()];
		int j = 0;
		for (int i = ucc.nextSetBit(0); i >= 0; i = ucc.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); 
		}
		UniqueColumnCombination uccResult = new UniqueColumnCombination(new ColumnCombination(columns));
		resultReceiver.receiveResult(uccResult);
		numUCCs++;
		return numUCCs;
	}
	
	if (this.getChildren() == null)
		return numUCCs;
		
	for (int childAttr = 0; childAttr < this.numAttributes; childAttr++) {
		UCCTreeElement element = this.getChildren()[childAttr];
		if (element != null) {
			ucc.set(childAttr);
			numUCCs += element.addUniqueColumnCombinationsInto(resultReceiver, ucc, columnIdentifiers, plis);
			ucc.clear(childAttr);
		}
	}
	return numUCCs;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:29,代码来源:UCCTreeElement.java

示例14: specializePositiveCover

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
protected int specializePositiveCover(OpenBitSet lhs, int rhs, FDList nonFds) {
	int numAttributes = this.posCover.getChildren().length;
	int newFDs = 0;
	List<OpenBitSet> specLhss;
	
	if (!(specLhss = this.posCover.getFdAndGeneralizations(lhs, rhs)).isEmpty()) { // TODO: May be "while" instead of "if"?
		for (OpenBitSet specLhs : specLhss) {
			this.posCover.removeFunctionalDependency(specLhs, rhs);
			
			if ((this.posCover.getMaxDepth() > 0) && (specLhs.cardinality() >= this.posCover.getMaxDepth()))
				continue;
			
			for (int attr = numAttributes - 1; attr >= 0; attr--) { // TODO: Is iterating backwards a good or bad idea?
				if (!lhs.get(attr) && (attr != rhs)) {
					specLhs.set(attr);
					if (!this.posCover.containsFdOrGeneralization(specLhs, rhs)) {
						this.posCover.addFunctionalDependency(specLhs, rhs);
						newFDs++;
						
						// If dynamic memory management is enabled, frequently check the memory consumption and trim the positive cover if it does not fit anymore
						this.memoryGuardian.memoryChanged(1);
						this.memoryGuardian.match(this.negCover, this.posCover, nonFds);
					}
					specLhs.clear(attr);
				}
			}
		}
	}
	return newFDs;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:31,代码来源:Inductor.java

示例15: add

import org.apache.lucene.util.OpenBitSet; //导入方法依赖的package包/类
public boolean add(OpenBitSet fd) {
	int length = (int) fd.cardinality();
	
	if ((this.maxDepth > 0) && (length > this.maxDepth))
		return false;
	
	this.depth = Math.max(this.depth, length);
	return this.fdLevels.get(length).add(fd);
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:10,代码来源:FDList.java


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