當前位置: 首頁>>代碼示例>>Java>>正文


Java IntArrayList類代碼示例

本文整理匯總了Java中it.unimi.dsi.fastutil.ints.IntArrayList的典型用法代碼示例。如果您正苦於以下問題:Java IntArrayList類的具體用法?Java IntArrayList怎麽用?Java IntArrayList使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IntArrayList類屬於it.unimi.dsi.fastutil.ints包,在下文中一共展示了IntArrayList類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: bfs

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的package包/類
private void bfs(Graph graph, int s) {
  IntArrayFIFOQueue queue = new IntArrayFIFOQueue();
  queue.enqueue(s);
  visited[s] = true;

  while (!queue.isEmpty()) {
    int v = queue.dequeueInt();

    IntArrayList adj = graph.adj(v);
    for (int i = 0; i < adj.size(); i++) {
      int w = adj.getInt(i);
      if (!visited[w]) {
        visited[w] = true;
        queue.enqueue(w);
        edgeTo[w] = v;
      }
    }
  }
}
 
開發者ID:kogupta,項目名稱:scala-playground,代碼行數:20,代碼來源:BFS.java

示例2: triangulateSingleNum

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的package包/類
public static void triangulateSingleNum(IntList data, List<int[]> idsVert){
	IntList dataNew=new IntArrayList(idsVert.size());
	int count=0;
	
	for(int[] face:idsVert){
		
		dataNew.add(data.getInt(count));
		dataNew.add(data.getInt(count+1));
		dataNew.add(data.getInt(count+2));
		if(face.length>3){
			dataNew.add(data.getInt(count));
			dataNew.add(data.getInt(count+2));
			dataNew.add(data.getInt(count+3));
		}
		count+=face.length;
	}
	
	data.clear();
	data.addAll(dataNew);
}
 
開發者ID:LapisSea,項目名稱:OpenGL-Bullet-engine,代碼行數:21,代碼來源:ModelUtil.java

示例3: contaminationDownsampling

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的package包/類
public void contaminationDownsampling(final Map<String, Double> perSampleDownsamplingFraction) {

        final int sampleCount = samples.sampleCount();
        final IntArrayList readsToRemove = new IntArrayList(10); // blind estimate, can be improved?
        final int alleleCount = alleles.alleleCount();
        for (int s = 0; s < sampleCount; s++) {
            final String sample = samples.sampleAt(s);
            final Double fractionDouble = perSampleDownsamplingFraction.get(sample);
            if (fractionDouble == null)
                continue;
            final double fraction = fractionDouble;
            if (Double.isNaN(fraction) || fraction <= 0.0)
                continue;
            if (fraction >= 1.0) {
                final int sampleReadCount = readsBySampleIndex[s].length;
                readsToRemove.ensureCapacity(sampleReadCount);
                for (int r = 0; r < sampleReadCount; r++)
                    readsToRemove.add(r);
                removeSampleReads(s, readsToRemove, alleleCount);
                readsToRemove.clear();
            } else {
                final Map<A, List<GATKSAMRecord>> readsByBestAllelesMap = readsByBestAlleleMap(s);
                removeSampleReads(s, AlleleBiasedDownsamplingUtils.selectAlleleBiasedReads(readsByBestAllelesMap, fraction), alleleCount);
            }
        }
    }
 
開發者ID:PAA-NCIC,項目名稱:SparkSeq,代碼行數:27,代碼來源:ReadLikelihoods.java

示例4: concat

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的package包/類
public static String concat(IntArrayList integers, String separator) {
	if (integers == null)
		return "";
	
	StringBuilder buffer = new StringBuilder();
	
	for (int integer : integers) {
		buffer.append(integer);
		buffer.append(separator);
	}
	
	if (buffer.length() > separator.length())
		buffer.delete(buffer.length() - separator.length(), buffer.length());
	
	return buffer.toString();
}
 
開發者ID:HPI-Information-Systems,項目名稱:metanome-algorithms,代碼行數:17,代碼來源:CollectionUtils.java

示例5: getListsCombinationIndices

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的package包/類
/**
 * Given a list of lists, return all the combinations between the lists (i.e. their indices). For example, suppose we
 * have the list of lists: [[1, 2, 3], [4, 5], [6, 7, 8]]. Then, this function will return:
 * [[0, 1], [1, 0], [0, 2], [2, 0], [1, 2], [2, 1], 
 *  [0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 1, 0], [2, 0, 1]]
 * @param lists: list of lists
 * @return
 */
public static <T> ObjectArrayList<IntArrayList> getListsCombinationIndices(ObjectArrayList<ObjectArrayList<T>> lists){
    ObjectArrayList<IntArrayList> combinationsInd = new ObjectArrayList<>();
    ObjectArrayList<IntArrayList> result = new ObjectArrayList<>();
    int[][] combinations;
    
    for (int k = 2; k <= lists.size(); k++){
        result.clear();
        combinations = null;
        
        combinations = getCombinations(k, lists.size());
        
        for (int i = 0; i < combinations.length; i++) {
            IntArrayList indices = new IntArrayList();
            for (int j = 0; j < combinations[i].length; j++) {
                indices.add(combinations[i][j]);
            }
            permute(indices, 0, result);
        }
        combinationsInd.addAll(result);
    }
    return combinationsInd;
}
 
開發者ID:gkiril,項目名稱:minie,代碼行數:31,代碼來源:FastUtil.java

示例6: output

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的package包/類
private void output() throws CouldNotReceiveResultException, ColumnNameMismatchException {
	// Read the discovered INDs from the attributes
	Int2ObjectOpenHashMap<IntList> dep2ref = new Int2ObjectOpenHashMap<IntList>(this.numColumns);
	for (Attribute spiderAttribute : this.attributeId2attributeObject.values())
		if (!spiderAttribute.getReferenced().isEmpty())
			dep2ref.put(spiderAttribute.getAttributeId(), new IntArrayList(spiderAttribute.getReferenced()));
	
	// Write the result to the resultReceiver
	for (int dep : dep2ref.keySet()) {
		String depTableName = this.getTableNameFor(dep, this.tableColumnStartIndexes);
		String depColumnName = this.columnNames.get(dep);
		
		for (int ref : dep2ref.get(dep)) {
			String refTableName = this.getTableNameFor(ref, this.tableColumnStartIndexes);
			String refColumnName = this.columnNames.get(ref);
			
			this.resultReceiver.receiveResult(new InclusionDependency(new ColumnPermutation(new ColumnIdentifier(depTableName, depColumnName)), new ColumnPermutation(new ColumnIdentifier(refTableName, refColumnName))));
			this.numUnaryINDs++;
		}
	}
}
 
開發者ID:HPI-Information-Systems,項目名稱:metanome-algorithms,代碼行數:22,代碼來源:SPIDER.java

示例7: overlappingReadIndicesBySampleIndex

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的package包/類
private int[][] overlappingReadIndicesBySampleIndex(final GenomeLoc overlap) {
    if (overlap == null)
        return null;
    final int sampleCount = samples.sampleCount();
    final int[][] result = new int[sampleCount][];
    final IntArrayList buffer = new IntArrayList(200);
    final int referenceIndex = overlap.getContigIndex();
    final int overlapStart = overlap.getStart();
    final int overlapEnd = overlap.getStop();
    for (int s = 0; s < sampleCount; s++) {
        buffer.clear();
        final GATKSAMRecord[] sampleReads = readsBySampleIndex[s];
        final int sampleReadCount = sampleReads.length;
        buffer.ensureCapacity(sampleReadCount);
        for (int r = 0; r < sampleReadCount; r++)
            if (unclippedReadOverlapsRegion(sampleReads[r], referenceIndex, overlapStart, overlapEnd))
                buffer.add(r);
        result[s] = buffer.toIntArray();
    }
    return result;
}
 
開發者ID:PAA-NCIC,項目名稱:SparkSeq,代碼行數:22,代碼來源:ReadLikelihoods.java

示例8: fetchPositionListIndexes

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的package包/類
protected List<PositionListIndex> fetchPositionListIndexes(List<HashMap<String, IntArrayList>> clusterMaps, boolean isNullEqualNull) {
	List<PositionListIndex> clustersPerAttribute = new ArrayList<>();
	for (int columnId = 0; columnId < clusterMaps.size(); columnId++) {
		List<IntArrayList> clusters = new ArrayList<>();
		HashMap<String, IntArrayList> clusterMap = clusterMaps.get(columnId);
		
		if (!isNullEqualNull)
			clusterMap.remove(null);
		
		for (IntArrayList cluster : clusterMap.values())
			if (cluster.size() > 1)
				clusters.add(cluster);
		
		clustersPerAttribute.add(new PositionListIndex(columnId, clusters));
	}
	return clustersPerAttribute;
}
 
開發者ID:HPI-Information-Systems,項目名稱:metanome-algorithms,代碼行數:18,代碼來源:PLIBuilder.java

示例9: fetchPositionListIndexesStatic

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的package包/類
protected static List<PositionListIndex> fetchPositionListIndexesStatic(List<HashMap<String, IntArrayList>> clusterMaps, boolean isNullEqualNull) {
	List<PositionListIndex> clustersPerAttribute = new ArrayList<>();
	for (int columnId = 0; columnId < clusterMaps.size(); columnId++) {
		List<IntArrayList> clusters = new ArrayList<>();
		HashMap<String, IntArrayList> clusterMap = clusterMaps.get(columnId);
		
		if (!isNullEqualNull)
			clusterMap.remove(null);
		
		for (IntArrayList cluster : clusterMap.values())
			if (cluster.size() > 1)
				clusters.add(cluster);
		
		clustersPerAttribute.add(new PositionListIndex(columnId, clusters));
	}
	return clustersPerAttribute;
}
 
開發者ID:HPI-Information-Systems,項目名稱:metanome-algorithms,代碼行數:18,代碼來源:PLIBuilder.java

示例10: isUniqueWith

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的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

示例11: Clause

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的package包/類
Clause() {
    this.constituents = new ObjectArrayList<Constituent>();
    this.type = Type.UNKNOWN;
    this.subject = -1;
    this.verb = -1;
    this.dobjects = new IntArrayList();
    this.iobjects = new IntArrayList();
    this.complement = -1;
    this.xcomps = new IntArrayList();
    this.ccomps = new IntArrayList();
    this.acomps = new IntArrayList();
    this.adverbials = new IntArrayList();
    this.relativeAdverbial = false;
    this.parentClause = null;
    this.include = new BooleanArrayList();
    this.propositions = new ObjectArrayList<Proposition>();
}
 
開發者ID:gkiril,項目名稱:minie,代碼行數:18,代碼來源:Clause.java

示例12: fetchNonFdsWindowingOverClusters

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的package包/類
private void fetchNonFdsWindowingOverClusters(Set<OpenBitSet> negCover, int[][] compressedRecords, List<PositionListIndex> plis) {
	System.out.println("\tMoving window over small clusters ...");
	for (PositionListIndex pli : plis) {
		boolean selectSmallClustersOnly = pli.getClusters().size() < this.attributeThreshold; 	// If there are too few clusters, then the clusters are large and we have already executed sufficient comparisons between the records of these clusters
		
		for (IntArrayList cluster : pli.getClusters()) {
			if (selectSmallClustersOnly && (cluster.size() > this.windowSize))					// But if the current cluster is very small, we should still use it for comparisons (the other cluster(s) must be very large)
				continue;
			
			for (int recordIndex = 0; recordIndex < cluster.size(); recordIndex++) {
				int recordId = cluster.getInt(recordIndex);
				
				for (int partnerRecordIndex = recordIndex + 1; partnerRecordIndex < Math.min(recordIndex + this.windowSize, cluster.size()); partnerRecordIndex++) {
					int partnerRecordId = cluster.getInt(partnerRecordIndex);
					
					negCover.add(this.getViolatedFds(compressedRecords[recordId], compressedRecords[partnerRecordId]));
				}
			}
		}
	}
}
 
開發者ID:HPI-Information-Systems,項目名稱:metanome-algorithms,代碼行數:22,代碼來源:HyFD.java

示例13: fetchNonFdsFromClustersTopsAndBottoms

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的package包/類
private void fetchNonFdsFromClustersTopsAndBottoms(Set<OpenBitSet> negCover, int[][] compressedRecords, List<PositionListIndex> plis) {
	System.out.println("\tComparing window on clusters tops and bottoms ...");
	for (PositionListIndex pli : plis) {
		for (IntArrayList cluster : pli.getClusters()) {
			if (cluster.size() < this.windowSize)
				continue;
			
			for (int recordIndex = 0; recordIndex < this.windowSize; recordIndex++) {
				int recordId = cluster.getInt(recordIndex);
				
				for (int partnerRecordIndex = cluster.size() - 1; partnerRecordIndex > cluster.size() - this.windowSize; partnerRecordIndex--) {
					int partnerRecordId = cluster.getInt(partnerRecordIndex);
					
					if (recordId == partnerRecordId)
						continue;
					
					negCover.add(this.getViolatedFds(compressedRecords[recordId], compressedRecords[partnerRecordId]));
				}
			}
		}
	}
}
 
開發者ID:HPI-Information-Systems,項目名稱:metanome-algorithms,代碼行數:23,代碼來源:HyFD.java

示例14: permute

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的package包/類
/**
 * Given a list of integers 'intList', make all the permutations of the elements in the list. The result is stored
 * in a list of list of integers 'result'. The parameter 'k' should always be set to 0 (it is used for the purposes of 
 * the recursion). 
 * For example, if intList = [0, 1, 2], then the result would be:
 * result = [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 1, 0], [2, 0, 1]]
 * @param intList: list of integers
 * @param k: 
 * @param result: permutations of the integer list (list of lists)
 */
private static void permute(IntArrayList intList, int k, ObjectArrayList<IntArrayList> result){
    // Avoid waaay to many permutations
    if (k > 1000) {
        return;
    }
    
    for(int i = k; i < intList.size(); i++){
        java.util.Collections.swap(intList, i, k);
        permute(intList, k + 1, result);
        java.util.Collections.swap(intList, k, i);
    }
    if (k == intList.size() -1){
        result.add(intList.clone());
    }
}
 
開發者ID:gkiril,項目名稱:minie,代碼行數:26,代碼來源:FastUtil.java

示例15: refines

import it.unimi.dsi.fastutil.ints.IntArrayList; //導入依賴的package包/類
public boolean refines(int[][] lhsInvertedPlis, int[] rhs) {
	for (IntArrayList cluster : this.clusters) {
		Object2IntOpenHashMap<IntArrayList> clustersMap = new Object2IntOpenHashMap<>(cluster.size());
		
		// Check if all subclusters of this cluster point into the same other clusters
		for (int recordId : cluster) {
			IntArrayList additionalLhsCluster = this.buildClusterIdentifier(recordId, lhsInvertedPlis);
			if (additionalLhsCluster == null)
				continue;
			
			if (clustersMap.containsKey(additionalLhsCluster)) {
				if ((rhs[recordId] == -1) || (clustersMap.getInt(additionalLhsCluster) != rhs[recordId]))
					return false;
			}
			else {
				clustersMap.put(additionalLhsCluster, rhs[recordId]);
			}
		}
	}
	return true;
}
 
開發者ID:HPI-Information-Systems,項目名稱:metanome-algorithms,代碼行數:22,代碼來源:PositionListIndex.java


注:本文中的it.unimi.dsi.fastutil.ints.IntArrayList類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。