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


Java TIntIterator类代码示例

本文整理汇总了Java中gnu.trove.TIntIterator的典型用法代码示例。如果您正苦于以下问题:Java TIntIterator类的具体用法?Java TIntIterator怎么用?Java TIntIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: collapse

import gnu.trove.TIntIterator; //导入依赖的package包/类
public void collapse(LinearBekGraph graph) {
  for (int upNodeIndex : myTailEdges.keys()) {
    for (int downNodeIndex : myTailEdges.get(upNodeIndex)) {
      removeEdge(graph, upNodeIndex, downNodeIndex);
    }
  }

  TIntIterator it = myTails.iterator();
  while (it.hasNext()) {
    int tail = it.next();
    if (!LinearGraphUtils.getDownNodes(graph, tail).contains(myLeftChild)) {
      addEdge(graph, tail, myLeftChild);
    }
    else {
      replaceEdge(graph, tail, myLeftChild);
    }
  }
  removeEdge(graph, myParent, myLeftChild);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:LinearBekGraphBuilder.java

示例2: iterator

import gnu.trove.TIntIterator; //导入依赖的package包/类
/**
 * Creates an iterator over the values of the set.
 *
 * @return an iterator with support for removals in the underlying set
 */
public Iterator<Integer> iterator() {
    return new Iterator<Integer>() {
        private final TIntIterator it = _set.iterator();

        public Integer next() {
            return wrap(it.next());
        }

        public boolean hasNext() {
            return it.hasNext();
        }

        public void remove() {
            it.remove();
        }
    };
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:23,代码来源:TIntHashSetDecorator.java

示例3: iterator

import gnu.trove.TIntIterator; //导入依赖的package包/类
/**
 * Creates an iterator over the values of the set.
 *
 * @return an iterator with support for removals in the underlying set
 */
@Override
public Iterator<Integer> iterator() {
    return new Iterator<Integer>() {
        private final TIntIterator it = _set.iterator();

        @Override
        public Integer next() {
            return wrap(it.next());
        }

        @Override
        public boolean hasNext() {
            return it.hasNext();
        }

        @Override
        public void remove() {
            it.remove();
        }
    };
}
 
开发者ID:square,项目名称:haha,代码行数:27,代码来源:TIntHashSetDecorator.java

示例4: iterator

import gnu.trove.TIntIterator; //导入依赖的package包/类
/**
    * Creates an iterator over the values of the set.
    *
    * @return an iterator with support for removals in the underlying set
    */
   public Iterator iterator() {
return new Iterator() {
	private final TIntIterator it = _set.iterator();
		    
	public Object next() {
	    return wrap(it.next());
	}

	public boolean hasNext() {
	    return it.hasNext();
	}

	public void remove() {
	    it.remove();
	}
    };
   }
 
开发者ID:clulab,项目名称:reach-banner,代码行数:23,代码来源:TIntHashSetDecorator.java

示例5: getTable

import gnu.trove.TIntIterator; //导入依赖的package包/类
public TIntDoubleHashMap getTable(double[][] utilities) {
    TIntDoubleHashMap rank = new TIntDoubleHashMap(
            (int) (testSize + testSize * 0.25), (float) 0.75);
    for (int docId = 0; docId < testSize; docId++) {
        double sum = 0.0;
        for (TIntIterator it = categoriesFilter.iterator(); it.hasNext(); ) {
            int catId = it.next();
            if (docCategoriesFilter[docId].contains(catId)) {
                sum += utilities[docId][catMap.get(catId)];
            }
        }
        rank.put(docId, sum);
    }
    return rank;
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:16,代码来源:UtilityBased.java

示例6: getTailsAndBody

import gnu.trove.TIntIterator; //导入依赖的package包/类
public Set<Integer> getTailsAndBody() {
  Set<Integer> nodes = ContainerUtil.newHashSet();
  TIntIterator it = myBlockBody.iterator();
  while (it.hasNext()) {
    nodes.add(it.next());
  }
  it = myTails.iterator();
  while (it.hasNext()) {
    nodes.add(it.next());
  }
  return nodes;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:LinearBekGraphBuilder.java

示例7: save

import gnu.trove.TIntIterator; //导入依赖的package包/类
@Override
public void save(@NotNull DataOutput out, TIntHashSet value) throws IOException {
  out.writeInt(value.size());
  final TIntIterator iterator = value.iterator();
  while (iterator.hasNext()) {
    out.writeInt(iterator.next());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DetectedFrameworksData.java

示例8: save

import gnu.trove.TIntIterator; //导入依赖的package包/类
@Override
public void save(DataOutput out, TIntHashSet value) throws IOException {
  out.writeInt(value.size());
  final TIntIterator iterator = value.iterator();
  while (iterator.hasNext()) {
    out.writeInt(iterator.next());
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:DetectedFrameworksData.java

示例9: intersect

import gnu.trove.TIntIterator; //导入依赖的package包/类
/**
 * This function computes the intersection of two sets.
 * 
 * @param a
 * @param b
 * @return the set of elements contained in both sets
 */
public static TIntHashSet intersect(TIntHashSet a, TIntHashSet b) {
	TIntHashSet result = new TIntHashSet();
	
	for (TIntIterator iterator = a.iterator(); iterator.hasNext(); ) {
		int x = iterator.next();
		
		if (b.contains(x)) {
			result.add(x);
		}
	}
	
	return result;
}
 
开发者ID:appliedtopology,项目名称:javaplex,代码行数:21,代码来源:ComparisonUtility.java

示例10: constructEdges

import gnu.trove.TIntIterator; //导入依赖的package包/类
@Override
protected UndirectedWeightedListGraph constructEdges() {
	int n = this.metricSpace.size();
	TIntHashSet neighborhood = null;

	UndirectedWeightedListGraph graph = new UndirectedWeightedListGraph(n);

	for (int i = 0; i < n; i++) {
		// obtain the neighborhood of the i-th point
		neighborhood = this.metricSpace.getClosedNeighborhood(metricSpace.getPoint(i), this.maxDistance);

		// get the pairwise distances of the points and store them
		TIntIterator iterator = neighborhood.iterator();
		while (iterator.hasNext()) {
			int j = iterator.next();

			if (i == j) {
				continue;
			}

			double distance = this.metricSpace.distance(i, j);
			graph.addEdge(i, j, distance);
		}
	}

	return graph;
}
 
开发者ID:appliedtopology,项目名称:javaplex,代码行数:28,代码来源:FlexibleVietorisRipsStream.java

示例11: updateWitnessInformation

import gnu.trove.TIntIterator; //导入依赖的package包/类
protected void updateWitnessInformation(int n_star, double e_ij, int... externalIndices) {

		TIntHashSet witnesses = this.getAllWitnesses(e_ij, externalIndices);

		for (TIntIterator iterator = witnesses.iterator(); iterator.hasNext();) {
			int witnessIndex = iterator.next();
			if (!this.witnessSimplexMap.contains(witnessIndex)) {
				this.witnessSimplexMap.put(witnessIndex, new ArrayList<Simplex>());
			}
			this.witnessSimplexMap.get(witnessIndex).add(Simplex.makeSimplex(externalIndices));
		}
	}
 
开发者ID:appliedtopology,项目名称:javaplex,代码行数:13,代码来源:LazyWitnessStream.java

示例12: computeLandmarkSet

import gnu.trove.TIntIterator; //导入依赖的package包/类
@Override
protected int[] computeLandmarkSet() {
	TIntHashSet landmarkSet = RandomUtility.randomSubset(this.landmarkSetSize, this.metricSpace.size());
	int[] indices = new int[this.landmarkSetSize];
	
	int index = 0;
	for (TIntIterator iterator = landmarkSet.iterator(); iterator.hasNext(); ) {
		indices[index] = iterator.next();
		index++;
	}
	
	return indices;
}
 
开发者ID:appliedtopology,项目名称:javaplex,代码行数:14,代码来源:RandomLandmarkSelector.java

示例13: computeMinDistance

import gnu.trove.TIntIterator; //导入依赖的package包/类
/**
 * This function computes the function f(z) = min{d(z, l_0), ...., d(z, l_{i-1}}.
 * 
 * @param queryPointIndex the index of the argument z in the above expression
 * @param existingLandmarkPoints the set {l_0, ..., l_{i-1}}
 * @return the value min{d(z, l_0), ...., d(z, l_{i-1}}
 */
private double computeMinDistance(int queryPointIndex, TIntHashSet existingLandmarkPoints) {
	double minDistance = Infinity.Double.getPositiveInfinity();

	for (TIntIterator iterator = existingLandmarkPoints.iterator(); iterator.hasNext(); ) {
		minDistance = Math.min(minDistance, this.metricSpace.distance(queryPointIndex, iterator.next()));
	}

	return minDistance;
}
 
开发者ID:appliedtopology,项目名称:javaplex,代码行数:17,代码来源:MaxMinLandmarkSelector.java

示例14: computeIntersection

import gnu.trove.TIntIterator; //导入依赖的package包/类
/**
 * This function computes the intersection between two sets of 
 * integers.
 * 
 * @param set1 the first set
 * @param set2 the second set
 * @return a TIntSet containing elements common to both input sets
 */
public static TIntHashSet computeIntersection(TIntHashSet set1, TIntHashSet set2) {
	TIntHashSet smallerSet = null;
	TIntHashSet largerSet = null;
	
	/*
	 * Let's identify the smaller and larger sets,
	 * so that we only need to iterate through the smaller one.
	 */
	if (set1.size() < set2.size()) {
		smallerSet = set1;
		largerSet = set2;
	} else {
		smallerSet = set2;
		largerSet = set1;
	}
	
	TIntHashSet intersection = new TIntHashSet();
	
	TIntIterator iterator = smallerSet.iterator();
	while (iterator.hasNext()) {
		int element = iterator.next();
		if (largerSet.contains(element)) {
			intersection.add(element);
		}
	}
	
	return intersection;
}
 
开发者ID:appliedtopology,项目名称:javaplex,代码行数:37,代码来源:HomologyUtility.java

示例15: pullUpIndices

import gnu.trove.TIntIterator; //导入依赖的package包/类
protected static TIntHashSet pullUpIndices(TIntHashSet subIndices, TIntHashSet indices) {
	TIntHashSet result = new TIntHashSet();

	TIntIterator iterator = subIndices.iterator();

	int[] indicesArray = indices.toArray();

	while (iterator.hasNext()) {
		int subIndex = iterator.next();
		result.add(indicesArray[subIndex]);
	}

	return result;
}
 
开发者ID:appliedtopology,项目名称:javaplex,代码行数:15,代码来源:MapperPipeline.java


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