本文整理匯總了Java中it.unimi.dsi.fastutil.ints.IntArrayList.size方法的典型用法代碼示例。如果您正苦於以下問題:Java IntArrayList.size方法的具體用法?Java IntArrayList.size怎麽用?Java IntArrayList.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類it.unimi.dsi.fastutil.ints.IntArrayList
的用法示例。
在下文中一共展示了IntArrayList.size方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: dfs
import it.unimi.dsi.fastutil.ints.IntArrayList; //導入方法依賴的package包/類
private void dfs(DirectedGraph graph, int v) {
visited[v] = true;
onStack[v] = true;
IntArrayList adj = graph.adj(v);
for (int i = 0; i < adj.size(); i++) {
int w = adj.getInt(i);
if (hasCycle) return;
else if (!visited[w]) {
edgeTo[w] = v;
dfs(graph, w);
} else if (onStack[w]) {
hasCycle = true;
cycle.push(w);
for (int r = v; r != w; r = edgeTo[r]) {
cycle.push(r);
}
cycle.push(w);
return;
}
}
onStack[v] = false;
}
示例3: 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;
}
}
}
}
示例4: 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]));
}
}
}
}
}
示例5: 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]));
}
}
}
}
}
示例6: 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;
}
示例7: prune
import it.unimi.dsi.fastutil.ints.IntArrayList; //導入方法依賴的package包/類
private void prune(Map<AttributeCombination, List<AttributeCombination>> naryDep2ref, IntArrayList attributeCombinationGroupIndexes, List<AttributeCombination> attributeCombinations) {
List<AttributeCombination> attributeCombinationGroup = new ArrayList<AttributeCombination>(attributeCombinationGroupIndexes.size());
for (int attributeCombinationIndex : attributeCombinationGroupIndexes)
attributeCombinationGroup.add(attributeCombinations.get(attributeCombinationIndex));
for (AttributeCombination attributeCombination : attributeCombinationGroup)
if (naryDep2ref.containsKey(attributeCombination))
naryDep2ref.get(attributeCombination).retainAll(attributeCombinationGroup);
}
示例8: runNext
import it.unimi.dsi.fastutil.ints.IntArrayList; //導入方法依賴的package包/類
public void runNext(UCCList newNonUCCs, int[][] compressedRecords) {
this.windowDistance++;
int numNewNonFds = 0;
int numComparisons = 0;
OpenBitSet equalAttrs = new OpenBitSet(this.posCover.getNumAttributes());
int previousNewNonFdsSize = newNonUCCs.size();
Iterator<IntArrayList> clusterIterator = this.clusters.iterator();
while (clusterIterator.hasNext()) {
IntArrayList cluster = clusterIterator.next();
if (cluster.size() <= this.windowDistance) {
clusterIterator.remove();
continue;
}
for (int recordIndex = 0; recordIndex < (cluster.size() - this.windowDistance); recordIndex++) {
int recordId = cluster.getInt(recordIndex);
int partnerRecordId = cluster.getInt(recordIndex + this.windowDistance);
this.sampler.match(equalAttrs, compressedRecords[recordId], compressedRecords[partnerRecordId]);
if (!this.negCover.contains(equalAttrs)) {
OpenBitSet equalAttrsCopy = equalAttrs.clone();
this.negCover.add(equalAttrsCopy);
newNonUCCs.add(equalAttrsCopy);
this.memoryGuardian.memoryChanged(1);
this.memoryGuardian.match(this.negCover, this.posCover, newNonUCCs);
}
numComparisons++;
}
}
numNewNonFds = newNonUCCs.size() - previousNewNonFdsSize;
this.numNewNonFds.add(numNewNonFds);
this.numComparisons.add(numComparisons);
}
示例9: sort
import it.unimi.dsi.fastutil.ints.IntArrayList; //導入方法依賴的package包/類
/**
* Given an IntArrayList object, sort it, and return an integer array, containing the sorted elements
* @param intList: the input list to be sorted
* @return a sorted integer array
*/
public static int [] sort(IntArrayList intList){
// Sort the indices and return them
int [] sorted = new int[intList.size()];
for (int i = 0; i < intList.size(); i++){
sorted[i] = intList.getInt(i);
}
IntArrays.quickSort(sorted);
return sorted;
}
示例10: intersect
import it.unimi.dsi.fastutil.ints.IntArrayList; //導入方法依賴的package包/類
public PositionListIndex intersect(int[] otherPLI) {
Int2ObjectMap<Int2ObjectMap<IntArrayList>> intersectMap = this.buildIntersectMap(otherPLI);
List<IntArrayList> clusters = new ArrayList<>();
for (Int2ObjectMap<IntArrayList> cluster1 : intersectMap.values())
for (IntArrayList cluster2 : cluster1.values())
if (cluster2.size() > 1)
clusters.add(cluster2);
return new PositionListIndex(-1, clusters);
}
示例11: runNext
import it.unimi.dsi.fastutil.ints.IntArrayList; //導入方法依賴的package包/類
public boolean runNext(Set<OpenBitSet> negCover, int[][] compressedRecords) {
this.windowDistance++;
int numNewNonFds = 0;
int numComparisons = 0;
int previousNegCoverSize = negCover.size();
Iterator<IntArrayList> clusterIterator = this.clusters.iterator();
while (clusterIterator.hasNext()) {
IntArrayList cluster = clusterIterator.next();
if (cluster.size() <= this.windowDistance) {
clusterIterator.remove();
continue;
}
for (int recordIndex = 0; recordIndex < (cluster.size() - this.windowDistance); recordIndex++) {
int recordId = cluster.getInt(recordIndex);
int partnerRecordId = cluster.getInt(recordIndex + this.windowDistance);
negCover.add(this.getViolatedFds(compressedRecords[recordId], compressedRecords[partnerRecordId]));
numComparisons++;
}
}
numNewNonFds = negCover.size() - previousNegCoverSize;
this.numNewNonFds.add(numNewNonFds);
this.numComparisons.add(numComparisons);
if (numComparisons == 0)
return false;
return true;
}
示例12: fetchNonFdsFromClustersTopsAndBottomsProgressive
import it.unimi.dsi.fastutil.ints.IntArrayList; //導入方法依賴的package包/類
private void fetchNonFdsFromClustersTopsAndBottomsProgressive(Set<OpenBitSet> negCover, int[][] compressedRecords, List<PositionListIndex> plis) {
System.out.println("\tComparing window on clusters tops and bottoms ...");
for (PositionListIndex pli : plis) {
int currentWindowDistance = 1;
int newNonFDs = 0;
do {
newNonFDs = 0;
for (IntArrayList cluster : pli.getClusters()) {
int recordIndex = currentWindowDistance;
int partnerRecordIndex = cluster.size() - currentWindowDistance;
if ((recordIndex >= cluster.size()) || (partnerRecordIndex < 0) || (recordIndex == partnerRecordIndex))
continue;
int recordId = cluster.getInt(recordIndex);
int partnerRecordId = cluster.getInt(partnerRecordIndex);
if (negCover.add(this.getViolatedFds(compressedRecords[recordId], compressedRecords[partnerRecordId])))
newNonFDs++;
}
currentWindowDistance++;
}
while (newNonFDs > this.progressiveThreshold);
}
}
示例13: runNext
import it.unimi.dsi.fastutil.ints.IntArrayList; //導入方法依賴的package包/類
public void runNext(FDList newNonFds, int[][] compressedRecords) {
this.windowDistance++;
int numNewNonFds = 0;
int numComparisons = 0;
OpenBitSet equalAttrs = new OpenBitSet(this.posCover.getNumAttributes());
int previousNegCoverSize = newNonFds.size();
Iterator<IntArrayList> clusterIterator = this.clusters.iterator();
while (clusterIterator.hasNext()) {
IntArrayList cluster = clusterIterator.next();
if (cluster.size() <= this.windowDistance) {
clusterIterator.remove();
continue;
}
for (int recordIndex = 0; recordIndex < (cluster.size() - this.windowDistance); recordIndex++) {
int recordId = cluster.getInt(recordIndex);
int partnerRecordId = cluster.getInt(recordIndex + this.windowDistance);
this.sampler.match(equalAttrs, compressedRecords[recordId], compressedRecords[partnerRecordId]);
if (!this.negCover.contains(equalAttrs)) {
OpenBitSet equalAttrsCopy = equalAttrs.clone();
this.negCover.add(equalAttrsCopy);
newNonFds.add(equalAttrsCopy);
this.memoryGuardian.memoryChanged(1);
this.memoryGuardian.match(this.negCover, this.posCover, newNonFds);
}
numComparisons++;
}
}
numNewNonFds = newNonFds.size() - previousNegCoverSize;
this.numNewNonFds.add(numNewNonFds);
this.numComparisons.add(numComparisons);
}
示例14: getVerbRootFromWordList
import it.unimi.dsi.fastutil.ints.IntArrayList; //導入方法依賴的package包/類
/**
* Given a list of indexed words and a semantic graph, return the root word of the word list. We assume that
* all the words from the list can be found in the semantic graph sg, and the words in wordList are connected
* within the semantic graph of the sentence - sg. If there are multiple words which have the shortest distance
* to the sentence root, then choose the most-left verb.
*
* @param sg: sentence semantic graph
* @param wordsList: list of words from which to choose "root" from
* @return
*/
public static IndexedWord getVerbRootFromWordList(SemanticGraph sg, ObjectArrayList<IndexedWord> wordList){
IndexedWord constituentRoot = null;
IntArrayList shortestDirectedPathDistances = new IntArrayList();
int minPathToRoot = Integer.MAX_VALUE;
int pathToRoot = -1;
for (int i = 0; i < wordList.size(); i++){
// The words with index -2 are the ones that cannot be found in the semantic graph (synthetic words)
// This happens in the relations (see in clausie.ClauseDetector.java), and those words are the head words
if (wordList.get(i).index() == -2){
return wordList.get(i);
}
pathToRoot = sg.getShortestDirectedPathNodes(sg.getFirstRoot(), wordList.get(i)).size();
if (pathToRoot < minPathToRoot){
minPathToRoot = pathToRoot;
}
shortestDirectedPathDistances.add(pathToRoot);
}
// If the shortest path is one element, return it, else, return the first verb containing that index
if (FastUtil.countElement(minPathToRoot, shortestDirectedPathDistances) == 1)
return wordList.get(shortestDirectedPathDistances.indexOf(minPathToRoot));
else {
for (int i = 0; i < shortestDirectedPathDistances.size(); i++){
if (shortestDirectedPathDistances.getInt(i) == minPathToRoot){
if (isVerb(wordList.get(i).tag())){
constituentRoot = wordList.get(i);
break;
}
}
}
}
return constituentRoot;
}
示例15: reverse
import it.unimi.dsi.fastutil.ints.IntArrayList; //導入方法依賴的package包/類
public DirectedGraph reverse() {
DirectedGraph graph = new DirectedGraph(V);
for (int v = 0; v < V; v++) {
IntArrayList neighbours = adj[v];
for (int i = 0; i < neighbours.size(); i++) {
int neighbour = neighbours.getInt(i);
graph.addEdge(neighbour, v);
}
}
return graph;
}